Feat: vite global support

This commit is contained in:
unitwk 2023-09-05 16:03:00 +08:00
parent 17720d32c0
commit db81fa3334
4 changed files with 12 additions and 14 deletions

View File

@ -1,7 +1,7 @@
import { createI18n } from "vue-i18n";
import enUS from "@/lang/en_US.json";
import zhCN from "@/lang/zh_CN.json";
import enUS from "@languages/en_US.json";
import zhCN from "@languages/zh_CN.json";
export const LANGUAGE_KEY = "LANGUAGE";

View File

@ -3,3 +3,7 @@ declare module "*.vue" {
const componentOptions: ComponentOptions;
export default componentOptions;
}
declare module "*.json" {
export default any;
}

View File

@ -1,23 +1,16 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": [
"env.d.ts",
"src/**/*",
"src/**/*.vue",
"src/config/**/*",
"src/lang/**/*.json"
],
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/config/**/*", "src/lang/**/*.json"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"@languages": ["../languages/*"]
},
"moduleResolution": "node",
"types": [
"node"
]
"types": ["node"]
}
}

View File

@ -36,7 +36,8 @@ export default defineConfig({
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url))
"@": fileURLToPath(new URL("./src", import.meta.url)),
"@languages": fileURLToPath(new URL("../languages", import.meta.url))
}
}
});