-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
57 lines (53 loc) · 1.39 KB
/
Copy pathwebpack.config.js
File metadata and controls
57 lines (53 loc) · 1.39 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
53
54
55
56
57
'use strict';
const LiveReloadPlugin = require('webpack-livereload-plugin');
const devMode = process.env.NODE_ENV === 'development';
const path = require('path');
/**
* 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: {
'bundle.js': path.resolve(__dirname, 'browser', 'index.jsx')
},
output: {
path: __dirname,
filename: 'browser/static/[name]'
},
context: __dirname,
devtool: devMode && USE_FAST_SOURCE_MAPS ?
'cheap-module-eval-source-map' :
'source-map',
resolve: {
extensions: ['.js', '/index.js', '.jsx', '/index.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
}),
{
apply: (compiler) => {
compiler.plugin('compilation', function() {
// This is just a utility, not part of the server
// eslint-disable-next-line no-console
console.log(new Date(), 'Build Started!');
});
}
}
] : []
};