forked from CalderaWP/Caldera-Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.blocks.js
34 lines (31 loc) · 985 Bytes
/
webpack.blocks.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
const defaultConfig = require("./node_modules/@wordpress/scripts/config/webpack.config");
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
const path = require('path');
//Remove default dependency extractor
const plugins = defaultConfig.plugins.filter(
plugin => plugin.constructor.name !== 'DependencyExtractionWebpackPlugin',
);
//Add dependency extractor back, with different options.
plugins.push(
new DependencyExtractionWebpackPlugin( {
injectPolyfill: true,
//By default php file is generated, we want JSON
outputFormat: 'json',
} ),
);
/**
* webpack config used for compiling blocks
*
* @since 1.8.6
*/
module.exports = {
...defaultConfig,
entry: {
index: path.resolve( process.cwd(), 'clients/blocks', 'index.js' ),
},
output: {
filename: 'index.min.js',
path: path.resolve( process.cwd(), 'clients/blocks/build' ),
},
plugins
};