-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathrspack.config.js
61 lines (60 loc) · 1.3 KB
/
rspack.config.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
const rspack = require("@rspack/core");
const ReactRefreshPlugin = require("@rspack/plugin-react-refresh");
const isProduction = process.env.NODE_ENV === "production";
/**
* @type {import('@rspack/cli').Configuration}
*/
module.exports = {
context: __dirname,
entry: {
main: "./src/index.tsx",
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".css"],
},
watchOptions: {
poll: 0,
aggregateTimeout: 0,
},
stats: {
timings: true,
all: false,
},
module: {
rules: [
{
test: /\.svg$/,
type: "asset",
},
{
test: /\.(js|ts|tsx|jsx)$/,
use: {
loader: "builtin:swc-loader",
options: {
sourceMap: true,
jsc: {
parser: {
syntax: "typescript",
tsx: true,
},
transform: {
react: {
runtime: "automatic",
development: !isProduction,
refresh: !isProduction,
},
},
},
},
},
},
],
},
plugins: [
new rspack.HtmlRspackPlugin({ template: "./index.webpack.html" }),
!isProduction && new ReactRefreshPlugin(),
].filter(Boolean),
experiments: {
css: true,
},
};