-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
45 lines (41 loc) · 1.11 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
'use strict';
const LiveReloadPlugin = require('webpack-livereload-plugin');
const devMode = process.env.NODE_ENV === 'development';
/**
* Fast source maps rebuild quickly during development, but only give a link
* to the line where the error occurred. The stack trace will show the bundled
* code, not the original code. Keep this on `false` for slower builds but
* usable stack traces. Set to `true` if you want to speed up development.
*/
const USE_FAST_SOURCE_MAPS = false;
module.exports = {
entry: './app/main.jsx',
output: {
path: __dirname,
filename: './public/bundle.js'
},
context: __dirname,
devtool: devMode && USE_FAST_SOURCE_MAPS ?
'cheap-module-eval-source-map' :
'source-map',
resolve: {
extensions: ['.js', '.jsx', '.json', '*']
},
module: {
rules: [{
test: /jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: 'babel-loader',
options: {
presets: ['react', 'es2015', 'stage-2']
}
}]
}]
},
plugins: devMode ? [
new LiveReloadPlugin({
appendScriptTag: true
})
] : []
};