-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.ts
58 lines (47 loc) · 1.24 KB
/
webpack.dev.ts
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
import path from "path";
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
import type { Configuration as WebpackConfig } from "webpack";
import type { Configuration as WebpackDevServerConfig } from "webpack-dev-server";
import merge from "webpack-merge";
import commonConfig from "./webpack.common";
type Configuration = WebpackConfig & { devServer: WebpackDevServerConfig };
const devConfig: Configuration = {
mode: "development",
entry: path.resolve(__dirname, "src/main.tsx"),
output: {
publicPath: "/",
},
devServer: {
compress: true,
historyApiFallback: true,
port: 3000,
open: true,
hot: true,
liveReload: false,
},
devtool: "cheap-module-source-map",
module: {
rules: [
{
test: /\.module\.css$/,
use: [
"style-loader",
{
loader: "css-loader",
options: { modules: true },
},
"postcss-loader",
],
},
{
test: {
and: [/\.css$/],
not: [/\.module\.css$/],
},
use: ["style-loader", "css-loader", "postcss-loader"],
},
],
},
plugins: [new ReactRefreshWebpackPlugin()],
};
export default merge(commonConfig, devConfig);