-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
45 lines (43 loc) · 1.44 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
const defaultConfig = require('@wordpress/scripts/config/webpack.config');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts');
module.exports = [
{
...defaultConfig,
entry: {
...defaultConfig.entry(),
'css/wp-content-pilot': './.assets/css/wp-content-pilot.scss',
'js/wp-content-pilot': './.assets/js/wp-content-pilot.js',
// Vendor -> ion slider assets.
'vendor/ionslider/css/ion.rangeSlider': './.assets/vendor/ionslider/ion.rangeSlider.css',
'vendor/ionslider/js/ion.rangeSlider': './.assets/vendor/ionslider/ion.rangeSlider.js',
// Vendor -> Select2 assets.
'vendor/select2/css/select2': './.assets/vendor/select2/select2.css',
'vendor/select2/js/select2': './.assets/vendor/select2/select2.js',
// Vendor -> tiptip assets.
'vendor/tiptip/jquery.tiptip.min': './.assets/vendor/tiptip/jquery.tiptip.min.js',
},
output: {
...defaultConfig.output,
filename: '[name].js',
path: __dirname + '/assets/',
},
plugins: [
...defaultConfig.plugins,
// Copy images to the build folder.
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, '.assets/images'),
to: path.resolve(__dirname, 'assets/images'),
}
]
}),
new RemoveEmptyScriptsPlugin({
stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
remove: /\.(js)$/,
}),
],
},
];