This repository has been archived by the owner on May 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreact4xp.properties
162 lines (128 loc) · 10.5 KB
/
react4xp.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# MAIN REACT4XP OPTIONAL SETTINGS
#
# Copy this to your local react4xp project root to use it, change or comment in/out values if needed.
#
# NOTE: These settings need to be read and used by react4xp/buildComponents to build a constants file under /build/. In this package
# (react4xp), there is a react4xp.gradle that takes care of that. Without those steps these settings won't have any effect.
#
# What to do? One of these:
# - Manual alternative: use react4xp.gradle as a template to write your own (adapted?) gradle setup in your
# project, that reads these variables and inserts them into buildconstants the same way. And make sure to
# update your own setup as needed, whenever you update react4xp from NPM.
# - Auto-updated alternative: add to your build.gradle: `apply from: "node_modules/react4xp/react4xp.gradle"`. This
# will make sure that you're always using the react4xp build setup that comes with the version of react4xp
# you're using. However, then you can't just run `enonic project deploy` without running `npm install` first, since
# the build now depends on an NPM package.
# - Auto-updated alternative, with NPM workaround: take a look at build.gradle in the react4xp starter
# (https://github.com/enonic/starter-react4xp/blob/master/build.gradle) and how it checks for whether
# react4xp.gradle exists (and runs `npm install` if not) before applying it.
#
##########################################################################################################################
# buildEnv sets the build mode:
# - 'production' yields compact output and will overwrite existing symlinks under node_modules. If needed, they must be rebuilt.
# - 'development' enables more verbose terminal output during build,
# - 'development' keeps compiled code more readable,
# - 'development' controls npmInstall.gradle, and instructs it to run the nsiInstall task instead of npmInstall.
# NsiInstall uses node-safe-install to wrap "npm install" in order to preserve existing symlinks under node_modules.
# Default build mode is 'production', but can be overridden with CLI arg: -Pdev or -Pdevelopment -Pdev when running gradle.
# Or uncomment the following line to lock development build mode:
#
# buildEnv = development
#################################### ENTRIES AND CHUNKING:
# If nothing is added below, this is the default behaviour:
# - Default entry source folder is /site/, that is: src/main/resources/site/ and its subfolders.
# - Everything under react4xp root folder (src/main/resources/react4xp/) will be considered chunks and will
# be bundled by webpack into a single dependency imported by webpack: react4xp.<contenthash>.js
# - Everything under the react4xp root folder (src/main/resources/react4xp/) will be considered non-entries:
# added files here can be imported by react4xp entries, but otherwise unreachable from react4xp.
# - Default entryExtensions (file extensions to look for when finding entries under OTHER entryDirs than /site/) are:
# jsx, js, tsx, ts, es6, es
# chunkDirs are folder names where importable, non-entry code is kept. Comma-separated list of folder names, relative
# to src/main/resources/react4xp/. Each folder added here will be bundled by webpack into a separate dependency
# chunk with the same name as the folder, and a hash: <foldername>.<contenthash>.js. This is good for grouping
# sets of dependencies that belong together, or will frequently be requested from the client together in some parts
# of a web page but not others, etc. The react4xp root (src/main/resources/react4xp/) is the standard chunk 'react4xp',
# but you can add subfolders here to bundle them (and their subfolders) in separate chunks. Or you can add relative
# paths to the react4xp root to imported dependency code from elsewhere. Don't overlap with entryDirs or /site/.
chunkDirs =
# entryDirs are additional folder names where webpack will look for entry files. Comma-separated list of folder names,
# relative to src/main/resources/react4xp/. By default, react4xp instructs webpack to look for entries under
# src/main/resources/site/ (and in the react4xp-templates package). Added folders here will be kept out of bundled
# dependency chunks (take care to avoid directory overlaps with chunkDirs) and treated separately. Files in
# them will be compiled into react4xp entries, which most importantly get a jsxPath (relative to their entryDir, not
# relative to /react4xp/) and therefore are available to react4xp.
# overrideComponentWebpack file (see above).
#
# For compatibility with earlier versions of react4xp, add _entries here.
entryDirs =
# entryExtensions are filename extensions of files (comma-separated list) below the entryDirs folders that webpack should
# look for and turn into entries. NOTE that this doesn't apply to the default entry-folder src/main/resources/site/
# (or the react4xp-templates package), where ONLY .jsx (and .tsx) files can be entries. This is to avoid mixups with
# XP controllers etc, which can be .js or .es6. Default value if not changed is jsx,js,tsx,ts,es6,es. Also note that
# tsx/ts files are NOT supported out of the box. Rules for typescript compilation must be added in your own
# entryExtensions =
#################################### SERVER-SIDE RENDERING:
# Overrides SSR lazy dependency loading. If not overridden (aka, if commented out below), it depends on build mode (buildEnv above):
# true in dev, false in prod.
# If false: all assets are loaded into the SSR engine as soon as it's initialized (on the first SSR):
# nashornpolyfills, externals, vendors, dependency chunks, react4xp-regions and entries, in that order.
# Fixed engine warm-up time, no further warm-up after initialization.
# If true: only nashornpolyfills and externals assets are loaded on engine initialization. Each entry and its dependency assets are
# loaded (and cached for shared re-use across entries) only the first time that entry is rendered,
# instead of loading everything on app startup.
# Here, initial engine warm-up time is shorter than without lazy-loading, and depends on which entry is rendered first
# - but the next entry rendering might require some more asset loading the first time THAT is rendered, etc.
# ssrLazyload = true
# Override SSR engine settings.
# Ref: https://github.com/openjdk/nashorn/blob/main/src/org.openjdk.nashorn/share/classes/org/openjdk/nashorn/internal/runtime/resources/Options.properties
# Default settings (if commented out) is:
# 0
# With lib-react4xp 1.5.5 or above, this corresponds to no additional settings; and nashorn cache switched off.
# If set to only a number, caching is switched on by setting the the number in '--persistent-code-cache', '--class-cache-size=<number>'.
# Note that this is an experimental nashorn feature! Results depend on the react4xp project, so your mileage may vary.
# But it has proven unstable in some react4xp projects (as well as not really delivering much performance gain, or even making it worse),
# therefore it's switched off by default.
# If a full string (more than just a number): completely overrides the default settings.
# Interpreted as a comma-separated list of settings, same format as the default settings above, for example:
# --persistent-code-cache, --class-cache-size=42, --lazy-compilation
#
# ssrSettings = 0
# Override the maximum SSR thread/engine count.
#
# Default value (if commented out): 0, which means no limit on number of threads - will be set to the number of available CPU cores.
# If set as a number above 0, limits the number of SSR engines that are available for simultaneous server-side rendering.
#
# It's usually not necessary to set a limit on this, the java thread model will limit it to the amount of available cores (and maybe multiplied, depending on CPU hyperthreading etc).
# However, each SSR engine will load the assets it needs for rendering into memory, in its own independent nashorn engine and memory space.
# And for performance reasons, these engines will be re-used as much as possible, trying to avoid initializing new engines.
# In other words, the memory used will NOT be cleared and made available after a rendering, but the engines will keep already-loaded assets
# in memory. And in the long run, the result will probably be that every engine will keep every compiled react asset in memory.
# If this ever becomes a problem, the ssrMaxThreads can be used to set a limit on this.
#
# ssrMaxThreads = 0
#################################### WEBPACK:
# A minimal webpack config is included with react4xp, to build your react components and their dependencies: See node_modules/react4xp/buildComponents/webpack.config.js.
# To change this setup, or override or extend that webpack.configjs:
# make a custom file that default-exports a (env, config) => webpackConfigObject function, where:
# - env is the collection of "--env" CLI arguments, and
# - config is the default config from react4xp/buildComponents/webpack.config.js.
# Basically, manipulate or replace the config object and return it.
# Example file:
# module.exports = function(env, config) {
# config.module.rules[0].test = /\.((tsx?)|(jsx?)|(es6))$/:
# return config;
# };
# Finally, refer to that file here (path/filename relative to this project's root) and uncomment it:
#
# overrideComponentWebpack = webpack.config.react4xp.js
# To add your own custom nashorn polyfills to the already-existing ones:
# make the a polyfilling file and refer to it here (path/filename relative to this project's root):
#
# nashornPolyfillsSource = src/main/resources/extraNashornPolyfills.es6
# Activates dependencies like react, react-dom, declared in the EXTERNALS config constant - see the react4xp-runtime-externals docs.
buildExternals = true
# File name for the built master config: this is the end result of this properties file, a constants file which is used both during build and runtime.
# Note that the runtime needs a copy of it in this location AND in the folder of the react4xp lib (a location predicted by the constants defined in the
# master config file itself). This is magically handled by the react4xp-buildconstants script package.
masterConfigFileName = build/react4xp_constants.json
overwriteConstantsFile = true