Skip to content

Commit

Permalink
feat: add unplugin-auto-import to rsbuild example
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Mar 17, 2024
1 parent 96695bf commit c24cc0c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
9 changes: 9 additions & 0 deletions vant/rsbuild/auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const showToast: typeof import('vant/es')['showToast']
}
7 changes: 4 additions & 3 deletions vant/rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"vue": "^3.4.12"
},
"devDependencies": {
"@rsbuild/core": "^0.4.1",
"@rsbuild/plugin-vue": "^0.4.1",
"@vant/auto-import-resolver": "^1.0.2",
"@rsbuild/core": "^0.4.15",
"@rsbuild/plugin-vue": "^0.4.15",
"@vant/auto-import-resolver": "^1.1.0",
"typescript": "^5.3.3",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0"
}
}
4 changes: 4 additions & 0 deletions vant/rsbuild/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from "@rsbuild/core";
import { pluginVue } from "@rsbuild/plugin-vue";
import AutoImport from "unplugin-auto-import/rspack";
import Components from "unplugin-vue-components/rspack";
import { VantResolver } from "@vant/auto-import-resolver";

Expand All @@ -8,6 +9,9 @@ export default defineConfig({
tools: {
rspack: {
plugins: [
AutoImport({
resolvers: [VantResolver()],
}),
Components({
resolvers: [VantResolver()],
}),
Expand Down
1 change: 0 additions & 1 deletion vant/rsbuild/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@

<script setup lang="ts">
import { ref } from "vue";
import { showToast } from "vant";
const goods = ref({
title: "美国伽力果213(约680g/3个)",
Expand Down

0 comments on commit c24cc0c

Please sign in to comment.