-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
55 lines (48 loc) · 1.47 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
48
49
50
51
52
53
54
55
// Based very loosely on https://www.reactstarterkit.com/
const path = require('path');
const webpack = require('webpack');
const isDebug = process.env.NODE_ENV === 'production';
module.exports = {
mode: isDebug ? 'development' : 'production',
context: path.resolve(__dirname, 'src'),
entry: path.resolve(__dirname, 'src/EventLoopPrinter.js'),
target: 'web',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'EventLoopPrinterWebpacked.js'
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
},
include: [
path.resolve(__dirname, './src')
],
exclude: [/node_modules/]
}
]
},
// Don't attempt to continue if there are any errors.
bail: !isDebug,
cache: isDebug,
plugins: [
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(require('./package.json').version), // eslint-disable-line
'process.env.NODE_ENV': isDebug ? '"development"' : '"production"',
'process.env.BROWSER': true,
__DEV__: isDebug
})
],
devtool: isDebug ? 'inline-source-map' : 'source-map',
stats: {
colors: true,
reasons: isDebug,
timings: true
}
};