-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsbuild.client.ts
More file actions
64 lines (58 loc) · 1.95 KB
/
rsbuild.client.ts
File metadata and controls
64 lines (58 loc) · 1.95 KB
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
import {defineConfig} from "@rsbuild/core"
import {pluginReact} from "@rsbuild/plugin-react"
import {pluginNodePolyfill} from "@rsbuild/plugin-node-polyfill"
import {pluginLess} from "@rsbuild/plugin-less"
import {pluginTypeCheck} from "@rsbuild/plugin-type-check"
import WebpackObfuscator from "webpack-obfuscator"
import dotenv from "dotenv"
const env = dotenv.config().parsed!
let minimize = env.TESTING === "no"
let obfuscator = env.OBFUSCATE === "yes"
let typecheck = env.TYPECHECK === "yes"
export default defineConfig({
tools: {
rspack(config) {
config.module = config.module || {}
config.module.rules = config.module.rules || []
config.module.rules.push({
test: /\.svg$/i,
type: "asset/inline",
})
if (obfuscator) {
config.plugins = config.plugins || []
config.plugins.push(new WebpackObfuscator())
}
return config
}
},
plugins: [
pluginReact(),
pluginLess(),
pluginNodePolyfill(),
pluginTypeCheck({enable: typecheck})
],
source: {
entry: {index: "./index.tsx"}
},
html: {
template: "./index.html",
favicon: "./assets/icons/favicon.png"
},
output: {
target: "web",
minify: minimize,
dataUriLimit: 0,
filenameHash: false,
sourceMap: false,
legalComments: "none",
distPath: {root: "./dist/client"},
copy: [
{from: "assets/audio worklet/bitcrusher.js", to: "[name][ext]"},
{from: "assets/audio worklet/soundtouch.js", to: "[name][ext]"},
{from: "assets/wasm/webpxmux.wasm", to: "[name][ext]"},
{from: "assets/wasm/avif_enc.wasm", to: "[name][ext]"},
{from: "assets/wasm/jxl_enc.wasm", to: "[name][ext]"},
{from: "assets/live2d/live2dcubismcore.min.js", to: "[name][ext]"},
]
}
})