| 1 |
const WPExtractorPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' ); |
| 2 |
const path = require( 'path' ); |
| 3 |
const devMode = !process.argv.join( ':' ). |
| 4 |
includes( '--mode:production' ); |
| 5 |
|
| 6 |
module.exports = { |
| 7 |
context: path.resolve( __dirname, 'assets/src' ), |
| 8 |
entry: { |
| 9 |
'editor': './editor/main.js', |
| 10 |
}, |
| 11 |
output: { |
| 12 |
path: path.resolve( __dirname, 'assets/build' ), |
| 13 |
devtoolNamespace: 'jfb-macros-inserter', |
| 14 |
}, |
| 15 |
devtool: devMode ? 'inline-cheap-module-source-map' : false, |
| 16 |
resolve: { |
| 17 |
extensions: [ '.js' ], |
| 18 |
}, |
| 19 |
module: { |
| 20 |
rules: [ |
| 21 |
{ |
| 22 |
test: /\.js(x)?$/, |
| 23 |
use: [ |
| 24 |
'babel-loader', |
| 25 |
], |
| 26 |
exclude: /node_modules/, |
| 27 |
}, |
| 28 |
], |
| 29 |
}, |
| 30 |
plugins: [ |
| 31 |
new WPExtractorPlugin(), |
| 32 |
], |
| 33 |
}; |
| 34 |
|