-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.config.js
47 lines (42 loc) · 1.06 KB
/
webpack.production.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
var webpack = require('webpack');
var path = require('path');
var nodeModulesPath = path.resolve(__dirname, 'node_modules');
var buildPath = path.resolve(__dirname, 'public', 'build');
var config = {
// We change to normal source mapping
devtool: 'source-map',
entry: './public/index.js',
output: {
path: buildPath,
filename: 'bundle.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: false
}
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
})
],
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel?presets[]=react,presets[]=es2015',
exclude: '/node_modules'
},
//This converts our .css into JS
{ test: /\.s?css$/, loaders: ['style', 'css', 'sass?outputStyle=expanded'] },
]
},
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss', '.json'],
modulesDirectories: [
'node_modules'
]
},
};
module.exports = config;