-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsbuild.server.ts
More file actions
54 lines (47 loc) · 1.41 KB
/
rsbuild.server.ts
File metadata and controls
54 lines (47 loc) · 1.41 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
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 nodeExternals from "webpack-node-externals"
import dotenv from "dotenv"
const env = dotenv.config().parsed!
let minimize = env.TESTING === "no"
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",
})
config.module.rules.push({
test: /\.(sql|txt)$/,
type: "asset/source",
})
config.externals = [nodeExternals()]
return config
}
},
plugins: [
pluginReact(),
pluginLess(),
pluginNodePolyfill(),
pluginTypeCheck({enable: typecheck})
],
source: {
entry: {server: "./server.tsx"}
},
output: {
target: "node",
minify: minimize,
dataUriLimit: 0,
filenameHash: false,
distPath: {root: "./dist/server"},
copy: [
{from: "index.html", to: "[name][ext]"}
]
}
})