-
Notifications
You must be signed in to change notification settings - Fork 0
/
react4xp.config.js
107 lines (93 loc) · 5.61 KB
/
react4xp.config.js
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
//──────────────────────────────────────────────────────────────────────────────
// A template version of this, with upated properties and explanations,
// can always be found in the react4xp NPM package:
// node_modules/react4xp/examples/react4xp.config.js after installing,
// or:
// https://github.com/enonic/enonic-react4xp/blob/master/examples/
// react4xp.config.js
//──────────────────────────────────────────────────────────────────────────────
module.exports = {
//──────────────────────────────────────────────────────────────────────────
// 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: ['jsx', 'js', 'tsx', 'ts', 'es6', 'es'],
// entryExtensionWhitelist: [
// 'css',
// 'd',
// 'sass',
// 'scss',
// 'styl'
// ],
//────────────────────────────────────────────────────────────────────────────
// Globals & Externals:
//────────────────────────────────────────────────────────────────────────────
// React4xp builds a globals bundle, which MUST contain all assets NEEDED to
// render server-side. By default it contains react and react-dom, but more
// assets can be added here:
globals: {
// lodash: '_'
},
// By default the globals bundle is also used on the client-side, but you
// can provide the REQUIRED assets on your own, for example via CDN.
//
// To disable serving the globals bundle to the client-side add this line to
// $XP_HOME/config/appname.cfg:
// react4xp.serveGlobals = false
// It's possible to have pure client-side rendered components in React4xp.
// If these components use assets which are NOT needed to render server-side
// you can add them here:
externals: {
// jquery: 'jQuery'
},
}; // module.exports