-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathwebpack.common.js
More file actions
65 lines (64 loc) · 1.77 KB
/
webpack.common.js
File metadata and controls
65 lines (64 loc) · 1.77 KB
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
64
65
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src', 'index.js'),
optimization: {
minimize: true,
minimizer: [],
splitChunks: {
chunks: 'all',
minSize: 20000,
maxSize: 100000,
maxAsyncRequests: 30,
maxInitialRequests: 30,
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
},
},
},
},
output: {
filename: '[name].[fullhash].bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: './',
},
module: {
rules: [
{
test: /\.jpe?g$|\.ico$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
use: [
{
loader: 'file-loader?name=[name].[ext]',
},
],
},
{
test: /\.html$/,
loader: 'html-loader',
},
],
},
plugins: [
new HtmlWebPackPlugin({
template: './src/index.html',
filename: 'index.html',
scriptLoading: 'defer',
inject: 'body',
favicon: './src/favicon.png',
}),
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 4200,
hot: false,
liveReload: true,
publicPath: '/',
watchContentBase: true,
},
};