-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrspack.config.ts
61 lines (53 loc) · 1.31 KB
/
rspack.config.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
59
60
61
import path from "node:path";
import rspack from "@rspack/core";
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
import createFeatureFlags from "./createFeatureFlags";
const debugMode = "DEBUG" in process.env;
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
const plugins: any = [];
if (debugMode)
plugins.push(
new RsdoctorRspackPlugin({
port: 3300
})
);
const config: rspack.Configuration = {
mode: debugMode ? "development" : "production",
entry: {
fetchInterceptor: path.resolve(
__dirname,
"./src/fetchInterceptorMiddleware.ts"
),
transport: path.resolve(__dirname, "./src/proxyMiddlewareTransport.ts"),
preTransport: path.resolve(
__diranme,
"./src/proxyMiddlewarePreTransport.ts"
),
liveMiddleware: path.resolve(__dirname, "./src/liveMiddleware.ts")
},
plugins,
resolve: {
extensions: [".ts"],
tsConfigPath: path.resolve(__dirname, "./tsconfig.json")
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/[\\/]node_modules[\\/]/],
loader: "builtin:swc-loader"
}
]
},
output: {
filename: "[name].aero.js",
path: debugMode
? path.resolve(__dirname, "dev-server/demo-site/aero")
: path.resolve(__dirname, "dist"),
iife: true,
clean: true
},
target: "webworker"
};
if (debugMode) config.watch = true;
export default config;