forked from htmlburger/carbon-fields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.core.js
54 lines (51 loc) · 1.17 KB
/
webpack.core.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
/**
* External dependencies.
*/
const webpack = require( 'webpack' );
const merge = require( 'webpack-merge' );
/**
* Internal dependencies.
*/
const base = require( './webpack.base' );
const paths = require( './paths' );
const wpPackages = require( './wp-packages' );
const config = {
entry: {
core: './packages/core/index.js'
},
output: {
library: [ 'cf', '[name]' ],
libraryTarget: 'this'
},
externals: {
'react': [ 'cf', 'vendor', 'react' ],
'react-dom': [ 'cf', 'vendor', 'react-dom' ],
'refract-callbag': [ 'cf', 'vendor', 'refract-callbag' ],
'callbag-basics': [ 'cf', 'vendor', 'callbag-basics' ],
'classnames': [ 'cf', 'vendor', 'classnames' ],
'immer': [ 'cf', 'vendor', 'immer' ]
}
};
module.exports = [
merge( base, config, {
output: {
path: paths.gutenbergBuildPath
},
externals: Object.assign( {}, wpPackages.externals, {
'lodash': [ 'lodash' ]
} )
} ),
merge( base, config, {
output: {
path: paths.classicBuildPath
},
externals: Object.assign( {}, wpPackages.proxyExternals, {
'lodash': [ 'cf', 'vendor', 'lodash' ]
} ),
plugins: [
new webpack.ProvidePlugin( {
'wp.element': '@wordpress/element'
} )
]
} )
];