-
Notifications
You must be signed in to change notification settings - Fork 212
/
webpack.config.js
33 lines (31 loc) · 1.22 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = (env, argv) => {
return {
entry: './web/src/index.js',
output: {
path: path.resolve(__dirname, 'web/dist'),
filename: 'script.[contenthash].js',
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'web/assets/template.html'),
filename: '../index.html',
warning: '<!-- \n\n\nDO NOT CHECK INTO VERSION CONTROL. \n\nThis file is generated! Please edit template.html instead! -->\n\n',
minify: {
collapseWhitespace: true,
keepClosingSlash: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
minifyCSS: true,
minifyJS: true,
},
}),
new CleanWebpackPlugin(),
],
devtool: argv.mode == 'development' ? 'source-map' : false,
}
};