-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathwebpack.config.js
60 lines (58 loc) · 1.36 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
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
module.exports = {
entry: {
app: [path.resolve(__dirname, 'src/index')],
},
output: {
path: path.resolve(__dirname, '_dist'),
filename: '[name]_[hash:8].js',
},
resolve: {
root: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules'),
__dirname,
],
extensions: ['', '.js'],
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
}, {
test: /\.css$/,
loaders: ['style', 'css'],
include: /components/,
}, {
test: /\.(jpe?g|png|gif|svg|ico)/i,
loader: 'file?name=img_[hash:8].[ext]',
}, {
test: /\.(ttf|eot|svg|woff|woff2)/,
loader: 'file',
}, {
test: /\.(pdf)/,
loader: 'file',
}, {
test: /\.(swf|xap)/,
loader: 'file',
}],
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
favicon: path.resolve(__dirname, 'src/favicon.ico'),
inject: false,
minify: {
html5: true,
collapseWhitespace: true,
// conservativeCollapse: true,
removeComments: true,
removeTagWhitespace: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
}
}),
],
};