Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unplugin-auto-import 插件,提供vue和uniapp的api自动引入能力 #48

Open
wants to merge 2 commits into
base: vite-ts
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
auto-imports.d.ts
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch(() => {
console.log("App Launch");
});
Expand Down
1 change: 0 additions & 1 deletion src/pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</template>

<script setup lang="ts">
import { ref } from 'vue'
const title = ref('Hello')
</script>

Expand Down
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -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"] })],
});