This repository has been archived by the owner on Jun 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
63 lines (62 loc) · 1.94 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
53
54
55
56
57
58
59
60
61
62
63
const HtmlMinifierPlugin = require('minify-html-webpack-plugin');
const path = require('path');
module.exports = {
watch: true,
entry: {
popup: path.resolve(__dirname, 'src/popup.js'),
background: path.resolve(__dirname, 'src/background.js'),
},
output: {
path: path.resolve(__dirname, 'build/'),
filename: '[name].js',
},
module: {
rules: [{
test: /\.s[ac]ss$/,
use: [{
loader: 'style-loader',
options: {
insert: 'head',
injectType: 'singletonStyleTag',
},
}, 'css-loader', {
loader: 'sass-loader',
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
includePaths: [path.resolve(__dirname, 'node_modules')],
},
},
}],
}],
},
resolve: {
modules: ['node_modules'],
extensions: ['.scss', '.js'],
},
plugins: [new HtmlMinifierPlugin({
src: path.resolve(__dirname, 'src/'),
dest: path.resolve(__dirname, 'build/'),
ignoreFileNameRegex: /(\.s[ac]ss$|\.js$)/,
rules: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
decodeEntities: true,
html5: true,
minifyCSS: true,
minifyJS: true,
removeAttributesQoutes: true,
removeComments: true,
removeEmptyAttributes: true,
removeOptionalTags: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
sortAttributes: true,
sortClassName: true,
useShortDoctype: true,
trimCustomFragments: true,
},
})],
};