forked from mixxen/react-webpack-express
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (43 loc) · 984 Bytes
/
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
var webpack = require('webpack');
const prod = process.argv.indexOf('-p') !== -1;
var definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'true')),
__PRERELEASE__: JSON.stringify(JSON.parse(process.env.BUILD_PRERELEASE || 'false')),
'process.env': {
NODE_ENV: JSON.stringify(prod ? 'production': 'development')
}
});
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
module.exports = {
cache: true,
resolve: {
extensions: ['', '.js', '.jsx']
},
entry: {
app: './src/App.jsx'
},
output: {
path: 'public/build',
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /(node_modules|bower_components)/,
query: {
presets: [
'react',
'es2015',
'stage-0'
]
}
}
]
},
plugins: [
definePlugin,
commonsPlugin
]
};