使用 rsbuild

This commit is contained in:
2024-10-15 12:06:24 +08:00
parent ecdee01e69
commit 4465806812
6 changed files with 1608 additions and 3729 deletions

View File

@@ -6,9 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>徐越的自测猫</title> <title>徐越的自测猫</title>
<link rel="stylesheet" href="/style.css" /> <link rel="stylesheet" href="/style.css" />
<script>
this.globalThis || (this.globalThis = window)
</script>
<script <script
async async
defer defer
@@ -17,6 +14,5 @@
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>

5281
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,8 +4,8 @@
"version": "1.1.0", "version": "1.1.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"start": "vite", "start": "rsbuild dev",
"build": "vue-tsc && vite build", "build": "rsbuild build",
"fmt": "prettier --write src" "fmt": "prettier --write src"
}, },
"dependencies": { "dependencies": {
@@ -26,12 +26,12 @@
}, },
"devDependencies": { "devDependencies": {
"@iconify/vue": "^4.1.2", "@iconify/vue": "^4.1.2",
"@rsbuild/core": "^1.0.14",
"@rsbuild/plugin-vue": "^1.0.2",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue": "^5.1.4",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.1.0", "prettier-plugin-organize-imports": "^4.1.0",
"terser": "^5.34.1",
"typescript": "^5.6.3", "typescript": "^5.6.3",
"vite": "^5.4.9", "vite": "^5.4.9",
"vue-tsc": "^2.1.6" "vue-tsc": "^2.1.6"

23
rsbuild.config.ts Normal file
View File

@@ -0,0 +1,23 @@
import { defineConfig } from "@rsbuild/core"
import { pluginVue } from "@rsbuild/plugin-vue"
export default defineConfig({
plugins: [pluginVue()],
html: {
template: "./index.html",
},
source: {
entry: {
index: "./src/main.ts",
},
},
performance: {
chunkSplit: {
strategy: "split-by-experience",
forceSplitting: {
"lib-ui": /node_modules[\\/]naive-ui/,
"lib-cm": /node_modules[\\/]@codemirror/,
},
},
},
})

View File

@@ -4,6 +4,5 @@
"module": "ESNext", "module": "ESNext",
"moduleResolution": "Node", "moduleResolution": "Node",
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
}, }
"include": ["vite.config.ts"]
} }

View File

@@ -1,22 +0,0 @@
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import legacy from "@vitejs/plugin-legacy"
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
file: ["file-saver", "client-zip"],
editor: [
"vue-codemirror",
"codemirror",
"@codemirror/lang-cpp",
"@codemirror/lang-python",
],
},
},
},
},
plugins: [vue(), legacy({ targets: ["chrome 66", "not IE 11"] })],
})