forked from xiangechen/chili3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rspack.config.js
93 lines (91 loc) · 2.37 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const rspack = require("@rspack/core");
const { defineConfig } = require("@rspack/cli");
const path = require("path");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const config = defineConfig({
entry: {
main: "./packages/chili-web/src/index.ts",
},
experiments: {
css: true,
},
module: {
parser: {
"css/auto": {
namedExports: false,
},
},
rules: [
{
test: /\.wasm$/,
type: "asset",
},
{
test: /\.cur$/,
type: "asset",
},
{
test: /\.jpg$/,
type: "asset",
},
{
test: /\.(j|t)s$/,
loader: "builtin:swc-loader",
options: {
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
target: "esnext",
},
},
},
],
},
resolve: {
extensions: [".ts", ".js"],
fallback: {
fs: false,
perf_hooks: false,
os: false,
crypto: false,
stream: false,
path: false,
},
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new rspack.CopyRspackPlugin({
patterns: [
{
from: "./public",
globOptions: {
ignore: ["**/**/index.html"],
},
},
],
}),
new rspack.DefinePlugin({
__APP_VERSION__: JSON.stringify(require("./package.json").version),
}),
new rspack.HtmlRspackPlugin({
template: "./public/index.html",
inject: "body",
}),
],
optimization: {
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin({
minimizerOptions: {
mangle: {
keep_classnames: true,
keep_fnames: true,
},
},
}),
new rspack.LightningCssMinimizerRspackPlugin(),
],
},
});
module.exports = config;