-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
52 lines (50 loc) · 1.5 KB
/
webpack.config.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
/**
* All of the the JavaScript compile functionality
* for `Insert Post Block` plugin reside in this file.
*/
const defaultConfig = require( './node_modules/@wordpress/scripts/config/webpack.config.js' );
const path = require( 'path' );
const chalk = require( 'chalk' );
const ProgressBarPlugin = require( 'progress-bar-webpack-plugin' );
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
const WebpackNotifierPlugin = require( 'webpack-notifier' );
const OptimizeCSSAssetsPlugin = require( 'optimize-css-assets-webpack-plugin' );
const LicenseCheckerWebpackPlugin = require( 'license-checker-webpack-plugin' );
module.exports = {
...defaultConfig,
entry: {
editor: path.resolve( process.cwd(), 'src', 'index.js' ),
},
optimization: {
...defaultConfig.optimization,
splitChunks: {
automaticNameDelimiter: '--',
},
minimizer: [
...defaultConfig.optimization.minimizer,
new OptimizeCSSAssetsPlugin( {
cssProcessorPluginOptions: {
preset: [ 'default', { discardComments: { removeAll: true } } ],
},
} ),
],
},
plugins: [
...defaultConfig.plugins,
new WebpackRTLPlugin( {
filename: '[name]-rtl.css',
} ),
new ProgressBarPlugin( {
format:
chalk.blue( 'Build core script' ) + ' [:bar] ' + chalk.green( ':percent' ) + ' :msg (:elapsed seconds)',
} ),
new LicenseCheckerWebpackPlugin( {
outputFilename: './credits.txt',
} ),
new WebpackNotifierPlugin( {
title: 'Insert Post Block',
alwaysNotify: true,
skipFirstNotification: true,
} ),
],
};