-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
57 lines (52 loc) · 1.61 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
'use strict';
var path = require('path');
var node_modules = path.resolve(__dirname, 'node_modules');
var webpack = require('webpack');
var IS_PROD = process.env.NODE_ENV === 'production';
console.log('Webpack started!');
console.log('Mode=' + process.env.NODE_ENV);
var plugins = IS_PROD ? [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({minimize: true, comments: false}),
new webpack.optimize.AggressiveMergingPlugin()
] : [];
module.exports = {
entry: ['babel-polyfill', path.resolve(__dirname, 'src/index.js')],
output: {
path: path.resolve(__dirname, 'public'),
filename: 'bundle.js',
publicPath: '/',
},
devtool: 'eval',
devServer: {
inline: true,
contentBase: 'public'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel-loader']
},
{
test: /\.scss$/,
loaders: ["style-loader", "css-loader", "sass-loader"]
},
{
test: /\.css$/,
loaders: ["style", "css"]},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&minetype=application/font-woff"
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/,
loader: 'url-loader?limit=10000'},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"}
]
},
plugins: plugins
};