forked from WordPress/pattern-directory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
32 lines (29 loc) · 827 Bytes
/
webpack.config.js
File metadata and controls
32 lines (29 loc) · 827 Bytes
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
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
const config = {
...defaultConfig,
output: {
...defaultConfig.output,
library: [ 'wp', 'patternCreator' ],
libraryTarget: 'window',
},
plugins: [
...defaultConfig.plugins.filter(
( plugin ) => plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
),
new DependencyExtractionWebpackPlugin( {
requestToExternal( request ) {
if (
request === '@wordpress/editor' ||
request === '@wordpress/icons' ||
request === '@wordpress/interface' ||
request === '@wordpress/fields' ||
request === '@wordpress/dataviews'
) {
return false;
}
},
} ),
],
};
module.exports = config;