From 3d70bb2c4a18c18ab0720cca903b7c927c17c55e Mon Sep 17 00:00:00 2001 From: PentaTea <2490445193@qq.com> Date: Wed, 16 Mar 2022 17:36:13 +0800 Subject: [PATCH 1/2] chore: add .gitigonre --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..de4d1f00 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +dist +node_modules From 6690a85e2489529c9fb1908425bb6d42f6292212 Mon Sep 17 00:00:00 2001 From: PentaTea <2490445193@qq.com> Date: Wed, 16 Mar 2022 17:42:22 +0800 Subject: [PATCH 2/2] chore: add unplugin-auto-import --- .gitignore | 1 + package.json | 1 + src/App.vue | 1 - src/pages/index/index.vue | 1 - tsconfig.json | 8 +++++++- vite.config.ts | 3 ++- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index de4d1f00..de74c2ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist node_modules +auto-imports.d.ts diff --git a/package.json b/package.json index 1e0253e2..779cb5aa 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@dcloudio/uni-mp-toutiao": "^3.0.0-alpha-3040120220308001", "@dcloudio/uni-mp-weixin": "^3.0.0-alpha-3040120220308001", "@dcloudio/uni-quickapp-webview": "^3.0.0-alpha-3040120220308001", + "unplugin-auto-import": "^0.6.6", "vue": "^3.2.31", "vue-i18n": "^9.1.9", "vuex": "^4.0.2" diff --git a/src/App.vue b/src/App.vue index 9b638c91..296376a4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,4 @@ diff --git a/tsconfig.json b/tsconfig.json index 5aec2fe8..7df0c81e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,11 @@ "lib": ["esnext", "dom"], "types": ["@dcloudio/types"] }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] + "include": [ + "src/**/*.ts", + "src/**/*.d.ts", + "src/**/*.tsx", + "src/**/*.vue", + "./auto-imports.d.ts" + ] } diff --git a/vite.config.ts b/vite.config.ts index 46e36fec..86583148 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,8 @@ import { defineConfig } from "vite"; import uni from "@dcloudio/vite-plugin-uni"; +import AutoImport from "unplugin-auto-import/vite"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [uni()], + plugins: [uni(), AutoImport({ imports: ["vue", "uni-app"] })], });