-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (41 loc) · 1.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
var path = require('path');
var webpack = require('webpack');
var minify = (process.env.NODE_ENV === 'production');
var plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(minify ? 'production' : 'development')
}
})
];
if (minify) {
plugins.push(new webpack.optimize.UglifyJsPlugin({
output: {
ascii_only: true,
}
}));
}
module.exports = {
entry: {
'main': './js/main.js',
},
output: {
path: path.join(__dirname, 'build'),
filename: '[name].bundle.js',
pathinfo: !minify
},
module: {
loaders: [
{ test: /knockout.build.output.knockout-latest.debug\.js/, loader: 'imports?require=>__webpack_require__' },
{ test: /\.js$/, loader: 'jsx-loader?harmony' },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
{ test: /\.json/, loader: 'json-loader' },
],
noParse: [
/knockout.build.output.knockout-latest.debug\.js/
]
},
plugins: plugins,
devtool: minify ? null : 'inline-source-map'
};