-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathwebpack-conf.js
50 lines (46 loc) · 1.42 KB
/
webpack-conf.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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const ZipPlugin = require('zip-webpack-plugin');
const webpackConf = require('webpack'); //to access built-in plugins
const path = require('path');
module.exports = {
entry: './js/core/monopoly.js',
mode: 'production',
output: {
path: path.join(__dirname, 'dist'),
filename: 'my-bundle.js'
},
module: {
rules: [
{
test: /monopoly\.js$/,
loader: 'string-replace-loader',
options: {
search: /let debug = true;/i,
replace: 'let debug = false;'
}
}
]
},
plugins: [
new HtmlWebpackPlugin({template: './monopoly-template.html'}),
new HtmlReplaceWebpackPlugin([
{
pattern: '<script type="module" src="js/core/monopoly.js"></script>',
replacement: ''
}]),
new CopyPlugin({
patterns: [
{from: "css", to: "css"},
{from: "img", to: "img"},
{from: "lib", to: "lib"},
{from: "data", to: "data"},
],
}),
new ZipPlugin({
path: '',
filename: 'monopoly_build.zip',
})
]
};