From d785d49dfbf51e420ffbd69aba9956b546144cbf Mon Sep 17 00:00:00 2001 From: Li Kui <90845831+likui628@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:07:59 +0800 Subject: [PATCH] fix: ts(1343),ts(2339) The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.ts(1343) Property 'env' does not exist on type 'ImportMeta'.ts(2339) --- configs/tsconfig/base.json | 6 +++++- packages/hooks/tsconfig.json | 4 ---- packages/layouts/tsconfig.json | 10 ++++++++++ packages/locale/tsconfig.json | 4 ---- packages/stores/src/modules/siteGeneral.ts | 1 - packages/stores/src/pinia.ts | 1 - packages/stores/tsconfig.json | 10 ++++++++++ packages/vbenComponents/tsconfig.json | 4 ---- 8 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 packages/layouts/tsconfig.json create mode 100644 packages/stores/tsconfig.json diff --git a/configs/tsconfig/base.json b/configs/tsconfig/base.json index 6d2060e6..2b300fbf 100644 --- a/configs/tsconfig/base.json +++ b/configs/tsconfig/base.json @@ -22,7 +22,11 @@ "resolveJsonModule": true, "removeComments": true, "noImplicitAny": false, - "experimentalDecorators": true + "experimentalDecorators": true, + "target": "esnext", + "module": "esnext", + "types": ["node", "vite/client"], + "lib": ["dom", "esnext"] }, "exclude": ["**/node_modules/**", "**/dist/**"] } diff --git a/packages/hooks/tsconfig.json b/packages/hooks/tsconfig.json index f49569b6..446a7495 100644 --- a/packages/hooks/tsconfig.json +++ b/packages/hooks/tsconfig.json @@ -1,14 +1,10 @@ { "extends": "tsconfig/base.json", "compilerOptions": { - "target": "esnext", - "module": "esnext", "baseUrl": ".", "paths": { "@/*": ["src/*"] }, - "lib": ["dom", "esnext"], - "types": ["vite/client"] }, "include": ["src"], "exclude": ["**/node_modules/**", "**/dist/**"] diff --git a/packages/layouts/tsconfig.json b/packages/layouts/tsconfig.json new file mode 100644 index 00000000..6f2122d0 --- /dev/null +++ b/packages/layouts/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "tsconfig/base.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "#/*": ["src/*"] + }, + }, + "include": ["src"] +} diff --git a/packages/locale/tsconfig.json b/packages/locale/tsconfig.json index f49569b6..446a7495 100644 --- a/packages/locale/tsconfig.json +++ b/packages/locale/tsconfig.json @@ -1,14 +1,10 @@ { "extends": "tsconfig/base.json", "compilerOptions": { - "target": "esnext", - "module": "esnext", "baseUrl": ".", "paths": { "@/*": ["src/*"] }, - "lib": ["dom", "esnext"], - "types": ["vite/client"] }, "include": ["src"], "exclude": ["**/node_modules/**", "**/dist/**"] diff --git a/packages/stores/src/modules/siteGeneral.ts b/packages/stores/src/modules/siteGeneral.ts index 927570d6..91dc2e9d 100644 --- a/packages/stores/src/modules/siteGeneral.ts +++ b/packages/stores/src/modules/siteGeneral.ts @@ -7,7 +7,6 @@ import defaultLogo from '@/assets/images/logo.png' import defaultAvatar from '@/assets/images/header.jpg' import { getGlobalConfig } from '@vben/utils' -// @ts-ignore const { title } = getGlobalConfig(import.meta.env) // github repo url diff --git a/packages/stores/src/pinia.ts b/packages/stores/src/pinia.ts index 37c34961..4355df16 100644 --- a/packages/stores/src/pinia.ts +++ b/packages/stores/src/pinia.ts @@ -7,7 +7,6 @@ import { createStorageName } from '@vben/utils' const pinia = createPinia() pinia.use( - // @ts-ignore createPersistedState(persistGlobalConfig(createStorageName(import.meta.env))), ) diff --git a/packages/stores/tsconfig.json b/packages/stores/tsconfig.json new file mode 100644 index 00000000..6f2122d0 --- /dev/null +++ b/packages/stores/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "tsconfig/base.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "#/*": ["src/*"] + }, + }, + "include": ["src"] +} diff --git a/packages/vbenComponents/tsconfig.json b/packages/vbenComponents/tsconfig.json index ea58aacb..6f2122d0 100644 --- a/packages/vbenComponents/tsconfig.json +++ b/packages/vbenComponents/tsconfig.json @@ -1,14 +1,10 @@ { "extends": "tsconfig/base.json", "compilerOptions": { - "target": "esnext", - "module": "esnext", "baseUrl": ".", "paths": { "#/*": ["src/*"] }, - "lib": ["dom", "esnext"], - }, "include": ["src"] }