generated from ncsa/react-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
50 lines (44 loc) · 1.36 KB
/
webpack.dev.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
const Webpack = require('webpack');
const { merge } = require('webpack-merge');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const commonConfig = require('./webpack.common');
module.exports = merge(commonConfig, {
mode: 'development',
devtool: 'eval-source-map',
module: {
rules: [
{
// Use babel-loader for ts, tsx, js, and jsx files
test: /\.[tj]sx?$/,
exclude: /node_modules/,
use: [
'babel-loader',
{
// Show eslint messages in the output
loader: 'eslint-loader',
options: {
emitWarning: true
}
}
]
},
]
},
devServer: {
hot: true,
host: 'localhost',
port: 3000,
open: true,
inline: true,
stats: 'minimal',
historyApiFallback: true,
allowedHosts: JSON.parse(process.env.ALLOWED_HOSTS || '["localhost"]'),
headers: { 'Access-Control-Allow-Origin': '*' }
},
plugins: [
new Webpack.DefinePlugin({
ENV: JSON.stringify('development')
}),
new BundleAnalyzerPlugin({ openAnalyzer: false, analyzerPort: 8081 })
],
});