Skip to content

Commit d2e7c9a

Browse files
committed
chore: 切换 Vite 配置为 MTS 并升级 5.4.21
- 统一 Vite 配置至 ESM .mts 并新增 node tsconfig 引用 - 更新脚本与文档指向新配置文件并同步依赖版本 Signed-off-by: Lulu <[email protected]>
1 parent ef5e35f commit d2e7c9a

File tree

7 files changed

+57
-35
lines changed

7 files changed

+57
-35
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ npm run i18n:check
206206
components/ui/*
207207
lib/*
208208
types/host.d.ts
209-
vite.config.ts
209+
vite.config.mts
210210
/tailwind.config.js
211211
/postcss.config.js
212212
/package.json

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ adapters/TerminalAdapter.tsx
206206
components/ui/*
207207
lib/*
208208
types/host.d.ts
209-
vite.config.ts
209+
vite.config.mts
210210
/tailwind.config.js
211211
/postcss.config.js
212212
/package.json

package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"type": "commonjs",
1818
"scripts": {
1919
"postinstall": "npm run build:electron && electron-builder install-app-deps",
20-
"dev:web": "vite --config web/vite.config.ts",
20+
"dev:web": "vite --config web/vite.config.mts",
2121
"dev:electron": "cross-env DEV_SERVER_URL=http://localhost:5173 electron .",
2222
"dev": "concurrently -k \"npm:dev:web\" \"npm:dev:electron\"",
2323
"dev:electron:dist": "cross-env DEV_SERVER_URL=file://local electron .",
2424
"dev:dist": "npm run build:electron && npm run build:web && npm run dev:electron:dist",
2525
"build:electron": "node scripts/clean-electron-dist.cjs && tsc -p tsconfig.electron.json",
26-
"build:web": "vite build --config web/vite.config.ts",
26+
"build:web": "vite build --config web/vite.config.mts",
2727
"build": "npm run build:electron && npm run build:web && electron-builder",
2828
"i18n:report": "node scripts/i18n-check.js STRICT=0",
2929
"i18n:check": "node scripts/i18n-check.js",
@@ -66,7 +66,7 @@
6666
"react-i18next": "^14.1.2",
6767
"tailwindcss": "^3.4.3",
6868
"typescript": "^5.4.5",
69-
"vite": "^5.2.8",
69+
"vite": "^5.4.21",
7070
"vitest": "^2.0.5"
7171
},
7272
"overrides": {},

web/tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (c) 2025 Lulu (GitHub: lulu-sk, https://github.com/lulu-sk)
13
{
24
"extends": "../tsconfig.json",
35
"compilerOptions": {
@@ -11,6 +13,9 @@
1113
"lib": ["ES2020", "DOM"],
1214
"types": []
1315
},
16+
"references": [
17+
{ "path": "./tsconfig.node.json" }
18+
],
1419
"include": ["src/**/*"],
1520
"exclude": ["dist", "node_modules"]
1621
}

web/tsconfig.node.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (c) 2025 Lulu (GitHub: lulu-sk, https://github.com/lulu-sk)
3+
{
4+
"extends": "../tsconfig.json",
5+
"compilerOptions": {
6+
"composite": true,
7+
"module": "NodeNext",
8+
"moduleResolution": "NodeNext",
9+
"noEmit": true,
10+
"types": ["node", "vitest"]
11+
},
12+
"include": ["vite.config.mts"]
13+
}
Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
1-
// SPDX-License-Identifier: Apache-2.0
2-
// Copyright (c) 2025 Lulu (GitHub: lulu-sk, https://github.com/lulu-sk)
3-
4-
import { defineConfig } from 'vite';
5-
import react from '@vitejs/plugin-react';
6-
import path from 'node:path';
7-
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Copyright (c) 2025 Lulu (GitHub: lulu-sk, https://github.com/lulu-sk)
3+
/// <reference types="vitest" />
4+
5+
import * as path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import react from "@vitejs/plugin-react";
8+
import { defineConfig } from "vitest/config";
9+
10+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
11+
812
export default defineConfig({
913
root: path.resolve(__dirname),
1014
// 产物部署在 file:// 协议下,使用相对 base 确保资源路径指向当前目录
11-
base: './',
15+
base: "./",
1216
plugins: [react()],
1317
resolve: {
14-
alias: {
15-
'@': path.resolve(__dirname, 'src')
16-
}
17-
},
18-
build: {
19-
outDir: 'dist',
20-
emptyOutDir: true
21-
},
18+
alias: {
19+
"@": path.resolve(__dirname, "src")
20+
}
21+
},
22+
build: {
23+
outDir: "dist",
24+
emptyOutDir: true
25+
},
2226
server: {
2327
port: 5173,
2428
strictPort: true
2529
},
2630
test: {
27-
environment: 'jsdom',
31+
environment: "jsdom",
2832
globals: true
2933
}
3034
});

0 commit comments

Comments
 (0)