-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
107 lines (105 loc) · 2.2 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const config = {
entry: './src/app.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'bundle.js'
},
module: {
rules: [{
test: /\.(css|sass|scss)$/,
use: [
'css-hot-loader',
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
{
test: /\.html$/,
use: [{
loader: 'raw-loader'
}]
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
minetype: 'application/font-woff'
}
}]
},
{
test: /\.woff2$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
minetype: 'application/font-woff'
}
}]
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
minetype: 'application/octet-stream'
}
}]
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
minetype: 'image/svg+xml'
}
}]
}]
},
plugins: [
new HtmlWebpackPlugin({
title: 'AngularJS - Webpack',
template: 'src/index.html',
inject: true
}),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
}),
new CopyWebpackPlugin([
'src/assets',
'src/config.json'
])
],
optimization: {
noEmitOnErrors: true,
minimizer: [new TerserPlugin()]
},
performance: {
maxAssetSize: 500000,
maxEntrypointSize: 2000000
},
devServer: {
contentBase: path.resolve(__dirname, './dist'),
historyApiFallback: true,
inline: true,
open: true,
hot: true
},
devtool: 'eval'
};
module.exports = config;