forked from regentmarkets-repo-archive/binary-next-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (50 loc) · 2.09 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
const path = require('path');
const webpack = require('webpack');
const WebpackNotifierPlugin = require('webpack-notifier');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const precss = require('precss');
const autoprefixer = require('autoprefixer');
const postCssModules = require('postcss-modules');
const env = process.env.NODE_ENV;
module.exports = {
devtool: env === 'production' ? 'source-map' : 'eval',
entry: './src',
output: {
path: path.join(__dirname, 'www'),
filename: 'app.js',
},
plugins: env === 'production' ? [
new ProgressBarPlugin({ width: 100 }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
})
] : [
new ProgressBarPlugin({ width: 100 }),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new WebpackNotifierPlugin({ title: 'Next-gen Build' }),
// new webpack.PrefetchPlugin('redux-storage/build/index.js'),
],
module: {
loaders: [
{ test: /\.(scss)$/, loader: 'stylelint' },
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
{ test: /\.js$/, exclude: /node_modules/, loader: 'eslint' },
{ test: /\.css$/, exclude: /node_modules/, loader: 'style!css?modules&importLoaders=1&localIdentName=[local]_[hash:base64:5]' },
{ test: /\.svg$/, loader: 'babel?presets[]=es2015,presets[]=react!svg-react' },
// { test: /\.css$/, exclude: /node_modules/, loader: 'style!css!postcss?modules&importLoaders=1&localIdentName=[local]_[hash:base64:5]' },
// { test: /\.scss$/, loader: ExtractTextPlugin.extract( 'css-loader?modules' + '&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' + '!postcss-loader' + '!sass' ), },
],
},
// postcss: () => [
// precss,
// postCssModules,
// autoprefixer,
// ],
};