-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
37 lines (32 loc) · 913 Bytes
/
webpack.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
/**
* WordPress Dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config.js' );
// Force Webpack to compile nicholas in this script.
defaultConfig.module.rules = defaultConfig.module.rules.map( ( rule ) => {
// If the webpack configuration excludes node modules, change the exclusion to compile Nicholas.
if ( rule.exclude && rule.exclude.toString() === /node_modules/.toString() ) {
rule.exclude = /node_modules\/!nicholas$/
}
return rule
} )
// Now, take the resulting export and combine it with last-minute overrides.
module.exports = {
...defaultConfig,
...{
/**
* Add your entry points for CSS and JS here.
*/
entry: {
theme: './src/theme.js',
editor: './src/editor.js',
sessionManager: './src/session-manager.js',
admin: './src/admin.js'
},
output: {
...defaultConfig.output,
libraryTarget: 'var',
library: '[name]'
},
}
}