-
Notifications
You must be signed in to change notification settings - Fork 39
/
webpack.config.js
79 lines (77 loc) · 1.78 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
var path = require('path');
const argv = require('yargs').argv;
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
var merge = require('webpack-merge');
const modeConfig = env => require(`./build-utils/webpack.${env}`)(env);
const { mode } = argv.env;
module.exports = () => {
return merge(
{
resolve: {
extensions: ['.js']
},
resolveLoader: {
moduleExtensions: ['-loader']
},
module: {
rules: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /(node_modules|bower_components)/
},
{
test: /\.js$/,
enforce: 'pre',
use: [{
loader: 'eslint-loader',
options: {
emitWarning: true,
emitError: true,
formatter: require('eslint-friendly-formatter')
}
}],
exclude: /node_modules/,
include: [path.join(__dirname, 'src')]
},
{
test: /\.tpl\.html$/,
use: {
loader: 'html-loader',
options: {
interpolate: true
}
},
exclude: /(node_modules|bower_components)/
},
{
test: /\.(jpe?g|png|gif)$/i,
loaders: [
'url-loader?limit=1000'
]
},
{
test: /\.(woff|woff2)(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff&prefix=fonts'
},
{
test: /\.ttf(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream&prefix=fonts'
},
{
test: /\.eot(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/vnd.ms-fontobject&prefix=fonts'
},
{
test: /\.svg(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=image/svg+xml&prefix=fonts'
}
]
},
plugins: [
// new BundleAnalyzerPlugin()
]
},
modeConfig(mode)
);
};