forked from cybernetisk/cybno-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
45 lines (40 loc) · 1.62 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 webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var production = process.env.NODE_ENV === 'production';
var noop = function () {};
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'public/build/'),
publicPath: 'build/',
filename: 'bundle.js',
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loaders: ['react-hot', 'babel-loader'] },
{ test: /\.json$/, loader: 'json' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader') },
{ test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&minetype=application/font-woff' },
{ test: /\.(ttf|eot|svg|gif)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader' },
]
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /nb/),
new ExtractTextPlugin("[name].css"),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
production && new webpack.optimize.DedupePlugin() || noop,
production && new webpack.optimize.UglifyJsPlugin({sourceMap: false}) || noop,
production && new webpack.NoErrorsPlugin() || noop,
production && new webpack.optimize.OccurenceOrderPlugin() || noop,
// removes a lot of debugging code in React
production && new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}) || noop
]
};