forked from ryohey/signal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
64 lines (62 loc) · 1.67 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
58
59
60
61
62
63
64
const { merge } = require("webpack-merge")
const common = require("./webpack.common.js")
const path = require("path")
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin")
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin")
const config = {
mode: "development",
devtool: "inline-source-map",
devServer: {
port: 3000,
hot: "only",
static: {
directory: path.resolve(__dirname, "public"),
watch: true,
},
client: {
overlay: {
warnings: false,
errors: true,
},
},
historyApiFallback: {
rewrites: [
{ from: /^\/edit$/, to: "/edit.html" },
{ from: /^\/auth$/, to: "/auth.html" },
{ from: /^\/home$/, to: "/community.html" },
{ from: /^\/profile$/, to: "/community.html" },
{ from: /^\/users\/.*$/, to: "/community.html" },
{ from: /^\/songs\/.*$/, to: "/community.html" },
{ from: /^\//, to: "/index.html" },
],
},
open: true,
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
plugins: [require.resolve("react-refresh/babel")],
},
},
},
],
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new ReactRefreshWebpackPlugin({
exclude: [/node_modules/, /processor.js/],
}),
],
resolve: {
alias: {
// Prevent to load local package's react https://github.com/facebook/react/issues/13991#issuecomment-435587809
react: path.resolve("./node_modules/react"),
},
},
}
module.exports = (env) => merge(common(env), config)