-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathwebpack.config.js
More file actions
49 lines (47 loc) · 1.51 KB
/
webpack.config.js
File metadata and controls
49 lines (47 loc) · 1.51 KB
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
/**
* External dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const path = require( 'path' );
/**
* WordPress dependencies externalization.
* These packages are provided by WordPress core and should not be bundled.
*/
const wordPressExternals = {
'@wordpress/block-editor': [ 'wp', 'blockEditor' ],
'@wordpress/blocks': [ 'wp', 'blocks' ],
'@wordpress/components': [ 'wp', 'components' ],
'@wordpress/compose': [ 'wp', 'compose' ],
'@wordpress/data': [ 'wp', 'data' ],
'@wordpress/element': [ 'wp', 'element' ],
'@wordpress/i18n': [ 'wp', 'i18n' ],
'@wordpress/rich-text': [ 'wp', 'richText' ],
'@wordpress/dom-ready': [ 'wp', 'domReady' ],
'@wordpress/api-fetch': [ 'wp', 'apiFetch' ],
'@wordpress/url': [ 'wp', 'url' ],
'@wordpress/hooks': [ 'wp', 'hooks' ],
'@wordpress/keycodes': [ 'wp', 'keycodes' ],
'@wordpress/primitives': [ 'wp', 'primitives' ],
'@wordpress/blob': [ 'wp', 'blob' ],
'@wordpress/format-library': [ 'wp', 'formatLibrary' ],
// Note: @wordpress/icons is NOT externalized - it gets bundled since
// @wordpress/components needs it internally and wp.icons may not be available.
};
module.exports = {
...defaultConfig,
entry: {
'press-this-editor': path.resolve( __dirname, 'src/index.js' ),
},
output: {
...defaultConfig.output,
path: path.resolve( __dirname, 'build' ),
filename: '[name].js',
},
externals: {
...defaultConfig.externals,
...wordPressExternals,
jquery: 'jQuery',
react: 'React',
'react-dom': 'ReactDOM',
},
};