-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
52 lines (47 loc) · 1.12 KB
/
webpack.config.js
File metadata and controls
52 lines (47 loc) · 1.12 KB
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
52
var webpack = require('webpack');
var path = require('path');
var loader = require('babel-loader');
var BUILD_DIR = path.resolve(__dirname, 'client/src/public');
var APP_DIR = path.resolve(__dirname, 'client/src');
var getPlugins = function() {
var plugins = [];
// do this push stuff in case we have to
// configure more plugins for production or
// development
plugins.push( new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development') }
}));
return plugins;
};
var config = {
entry: APP_DIR + '/index.jsx',
devtool: 'source-map',
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
externals: {
'cheerio':
'window',
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react', 'stage-0']
},
exclude: /node_modules/,
}
],
},
plugins: getPlugins(),
watch: true
};
module.exports = config;