diff --git a/rsbuild/vue3-vant/.gitignore b/rsbuild/vue3-vant/.gitignore new file mode 100644 index 00000000..38d7344c --- /dev/null +++ b/rsbuild/vue3-vant/.gitignore @@ -0,0 +1,13 @@ +# Local +.DS_Store +*.local +*.log* + +# Dist +node_modules +dist/ + +# IDE +.vscode/* +!.vscode/extensions.json +.idea diff --git a/rsbuild/vue3-vant/README.md b/rsbuild/vue3-vant/README.md new file mode 100644 index 00000000..37b1dd33 --- /dev/null +++ b/rsbuild/vue3-vant/README.md @@ -0,0 +1,29 @@ +# Rsbuild Project + +## Setup + +Install the dependencies: + +```bash +pnpm install +``` + +## Get Started + +Start the dev server: + +```bash +pnpm dev +``` + +Build the app for production: + +```bash +pnpm build +``` + +Preview the production build locally: + +```bash +pnpm preview +``` diff --git a/rsbuild/vue3-vant/auto-imports.d.ts b/rsbuild/vue3-vant/auto-imports.d.ts new file mode 100644 index 00000000..2e6dec61 --- /dev/null +++ b/rsbuild/vue3-vant/auto-imports.d.ts @@ -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'] +} diff --git a/rsbuild/vue3-vant/components.d.ts b/rsbuild/vue3-vant/components.d.ts new file mode 100644 index 00000000..27b5973b --- /dev/null +++ b/rsbuild/vue3-vant/components.d.ts @@ -0,0 +1,20 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +declare module 'vue' { + export interface GlobalComponents { + VanActionBar: typeof import('vant/es')['ActionBar'] + VanActionBarButton: typeof import('vant/es')['ActionBarButton'] + VanActionBarIcon: typeof import('vant/es')['ActionBarIcon'] + VanCell: typeof import('vant/es')['Cell'] + VanCellGroup: typeof import('vant/es')['CellGroup'] + VanCol: typeof import('vant/es')['Col'] + VanSwipe: typeof import('vant/es')['Swipe'] + VanSwipeItem: typeof import('vant/es')['SwipeItem'] + VanTag: typeof import('vant/es')['Tag'] + } +} diff --git a/rsbuild/vue3-vant/package.json b/rsbuild/vue3-vant/package.json new file mode 100644 index 00000000..d0c93d5c --- /dev/null +++ b/rsbuild/vue3-vant/package.json @@ -0,0 +1,22 @@ +{ + "name": "rsbuild-vue3-vant", + "private": true, + "version": "1.0.0", + "scripts": { + "dev": "rsbuild dev --open", + "build": "rsbuild build", + "preview": "rsbuild preview" + }, + "dependencies": { + "vant": "^4.8.2", + "vue": "^3.4.12" + }, + "devDependencies": { + "@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" + } +} diff --git a/rsbuild/vue3-vant/rsbuild.config.ts b/rsbuild/vue3-vant/rsbuild.config.ts new file mode 100644 index 00000000..6e10dd77 --- /dev/null +++ b/rsbuild/vue3-vant/rsbuild.config.ts @@ -0,0 +1,21 @@ +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"; + +export default defineConfig({ + plugins: [pluginVue()], + tools: { + rspack: { + plugins: [ + AutoImport({ + resolvers: [VantResolver()], + }), + Components({ + resolvers: [VantResolver()], + }), + ], + }, + }, +}); diff --git a/rsbuild/vue3-vant/src/App.vue b/rsbuild/vue3-vant/src/App.vue new file mode 100644 index 00000000..78351f4e --- /dev/null +++ b/rsbuild/vue3-vant/src/App.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/rsbuild/vue3-vant/src/env.d.ts b/rsbuild/vue3-vant/src/env.d.ts new file mode 100644 index 00000000..502e9f96 --- /dev/null +++ b/rsbuild/vue3-vant/src/env.d.ts @@ -0,0 +1,9 @@ +/// + +declare module '*.vue' { + import type { DefineComponent } from 'vue'; + + // eslint-disable-next-line + const component: DefineComponent<{}, {}, any>; + export default component; +} diff --git a/rsbuild/vue3-vant/src/index.ts b/rsbuild/vue3-vant/src/index.ts new file mode 100644 index 00000000..2b3aee1c --- /dev/null +++ b/rsbuild/vue3-vant/src/index.ts @@ -0,0 +1,5 @@ +import { createApp } from 'vue'; +import App from './App.vue'; + +const app = createApp(App); +app.mount('#root'); diff --git a/rsbuild/vue3-vant/src/static/apple.jpeg b/rsbuild/vue3-vant/src/static/apple.jpeg new file mode 100644 index 00000000..c313b9f4 Binary files /dev/null and b/rsbuild/vue3-vant/src/static/apple.jpeg differ diff --git a/rsbuild/vue3-vant/tsconfig.json b/rsbuild/vue3-vant/tsconfig.json new file mode 100644 index 00000000..13a86547 --- /dev/null +++ b/rsbuild/vue3-vant/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2020", + "lib": ["DOM", "ES2020"], + "module": "ESNext", + "strict": true, + "skipLibCheck": true, + "isolatedModules": true, + "resolveJsonModule": true, + "moduleResolution": "bundler" + }, + "include": ["src", "./auto-imports.d.ts", "components.d.ts"] +}