-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsbuild.config.ts
49 lines (46 loc) · 938 Bytes
/
rsbuild.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
import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { presets, tagBuilder } from "gen_dep_tag";
const tag = tagBuilder({ sri: true });
export default defineConfig({
plugins: [pluginReact()],
output: {
assetPrefix: "./",
polyfill: "off",
externals: {
"react": "React",
"react-dom": "ReactDOM",
"@monaco-editor/loader": "monaco_loader",
},
},
html: {
title: "SWC AST Viewer",
tags: [
tag(presets.react),
tag(presets["react-dom"]),
tag({
name: "@monaco-editor/loader",
entry: "lib/umd/monaco-loader.min.js",
}),
].map(htmlTag),
},
performance: {
preconnect: [
"//cdn.jsdelivr.net",
],
dnsPrefetch: [
"//cdn.jsdelivr.net",
],
},
});
function htmlTag(meta: ReturnType<typeof tag>) {
const { url, integrity } = meta;
return {
tag: "script",
attrs: {
src: url,
integrity,
crossorigin: "anonymous",
},
};
}