-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
57 lines (50 loc) · 1.6 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
51
52
53
54
55
56
57
// eslint-disable-next-line import/no-extraneous-dependencies
import webpack from 'webpack';
// eslint-disable-next-line import/no-extraneous-dependencies
import { merge } from 'webpack-merge';
// eslint-disable-next-line import/no-extraneous-dependencies
import CopyPlugin from 'copy-webpack-plugin';
// eslint-disable-next-line import/no-extraneous-dependencies
import HtmlWebpackPlugin from 'html-webpack-plugin';
// eslint-disable-next-line import/no-extraneous-dependencies
import path from 'path';
// eslint-disable-next-line import/extensions
import common from './webpack.js';
export default merge(common, {
mode: 'development',
// Configure entry points
entry: './src/dev.tsx',
// Global constants
plugins: [
new webpack.DefinePlugin({
'process.env.mode': JSON.stringify('development'),
}),
new HtmlWebpackPlugin({
template: './src/index.html',
}),
new CopyPlugin({
patterns: [
{ from: 'src/public', to: '' },
],
}),
],
// Dev Server: code refers to src instead of compiled/transpiled code
devtool: 'source-map',
// Dev Server: Served from ./dist folder
devServer: {
// Server
static: {
directory: path.resolve('dist'),
},
port: 3000,
// Enable adress bar functionality for react-router
historyApiFallback: {
rewrites: [
{ from: /^.*\/main\.js$/, to: '/main.js' },
],
},
// Enable hot reloading
hot: true,
liveReload: true,
},
});