-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
executable file
·47 lines (44 loc) · 1.33 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
const webpack = require('webpack');
const path = require('path');
// NODE_ENV set to production in heroku, so defaulting to 'development' here
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
module.exports = {
entry: [
'./public/index.js',
],
output: {
path: path.join(__dirname, './public'),
filename: 'bundle.js',
publicPath: '/'
},
module: {
loaders: [{
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['react', 'es2015', 'stage-1'],
},
}],
},
devtool: process.env.NODE_ENV !== 'production' ? 'inline-sourcemap' : null,
plugins: process.env.NODE_ENV !== 'production' ? [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoErrorsPlugin()] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.Occurence.Plugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
resolve: {
root: __dirname,
// this allows up to use aliases when we require from the following folders
modulesDirectories: [
'node_modules',
'./src/components',
'./src/reducers',
'./src/actions',
],
extensions: ['', '.js', '.jsx'],
},
//excluding sourcemaps when on heroku
devtool: process.env.NODE_ENV === 'production' ? undefined : 'cheap-module-eval-source-map'
};