docs: remove VantImports example (#12894)

This commit is contained in:
neverland 2024-05-28 23:14:10 +08:00 committed by GitHub
parent 0adc41acaa
commit 6cef6b88eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 44 deletions

View File

@ -34,12 +34,11 @@ bun add @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import
// vite.config.ts // vite.config.ts
import AutoImport from 'unplugin-auto-import/vite'; import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite'; import Components from 'unplugin-vue-components/vite';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -55,12 +54,11 @@ export default defineConfig({
// rollup.config.js // rollup.config.js
import AutoImport from 'unplugin-auto-import/rollup'; import AutoImport from 'unplugin-auto-import/rollup';
import Components from 'unplugin-vue-components/rollup'; import Components from 'unplugin-vue-components/rollup';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default { export default {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -76,12 +74,11 @@ export default {
// webpack.config.js // webpack.config.js
import AutoImport from 'unplugin-auto-import/webpack'; import AutoImport from 'unplugin-auto-import/webpack';
import Components from 'unplugin-vue-components/webpack'; import Components from 'unplugin-vue-components/webpack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
module.exports = { module.exports = {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -97,12 +94,11 @@ module.exports = {
// rspack.config.js // rspack.config.js
import AutoImport from 'unplugin-auto-import/rspack'; import AutoImport from 'unplugin-auto-import/rspack';
import Components from 'unplugin-vue-components/rspack'; import Components from 'unplugin-vue-components/rspack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
module.exports = { module.exports = {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -118,13 +114,12 @@ module.exports = {
// vue.config.js // vue.config.js
import AutoImport from 'unplugin-auto-import/webpack'; import AutoImport from 'unplugin-auto-import/webpack';
import Components from 'unplugin-vue-components/webpack'; import Components from 'unplugin-vue-components/webpack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
module.exports = { module.exports = {
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -142,12 +137,11 @@ module.exports = {
import { build } from 'esbuild'; import { build } from 'esbuild';
import AutoImport from 'unplugin-auto-import/esbuild'; import AutoImport from 'unplugin-auto-import/esbuild';
import Components from 'unplugin-vue-components/esbuild'; import Components from 'unplugin-vue-components/esbuild';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
build({ build({
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({

View File

@ -34,12 +34,11 @@ bun add @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import
// vite.config.ts // vite.config.ts
import AutoImport from 'unplugin-auto-import/vite'; import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite'; import Components from 'unplugin-vue-components/vite';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -55,12 +54,11 @@ export default defineConfig({
// rollup.config.js // rollup.config.js
import AutoImport from 'unplugin-auto-import/rollup'; import AutoImport from 'unplugin-auto-import/rollup';
import Components from 'unplugin-vue-components/rollup'; import Components from 'unplugin-vue-components/rollup';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default { export default {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -76,12 +74,11 @@ export default {
// webpack.config.js // webpack.config.js
import AutoImport from 'unplugin-auto-import/webpack'; import AutoImport from 'unplugin-auto-import/webpack';
import Components from 'unplugin-vue-components/webpack'; import Components from 'unplugin-vue-components/webpack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
module.exports = { module.exports = {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -97,12 +94,11 @@ module.exports = {
// rspack.config.js // rspack.config.js
import AutoImport from 'unplugin-auto-import/rspack'; import AutoImport from 'unplugin-auto-import/rspack';
import Components from 'unplugin-vue-components/rspack'; import Components from 'unplugin-vue-components/rspack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
module.exports = { module.exports = {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -118,13 +114,12 @@ module.exports = {
// vue.config.js // vue.config.js
import AutoImport from 'unplugin-auto-import/webpack'; import AutoImport from 'unplugin-auto-import/webpack';
import Components from 'unplugin-vue-components/webpack'; import Components from 'unplugin-vue-components/webpack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
module.exports = { module.exports = {
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -142,12 +137,11 @@ module.exports = {
import { build } from 'esbuild'; import { build } from 'esbuild';
import AutoImport from 'unplugin-auto-import/esbuild'; import AutoImport from 'unplugin-auto-import/esbuild';
import Components from 'unplugin-vue-components/esbuild'; import Components from 'unplugin-vue-components/esbuild';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
build({ build({
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({

View File

@ -152,7 +152,7 @@ import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVue } from '@rsbuild/plugin-vue';
import AutoImport from 'unplugin-auto-import/rspack'; import AutoImport from 'unplugin-auto-import/rspack';
import Components from 'unplugin-vue-components/rspack'; import Components from 'unplugin-vue-components/rspack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default defineConfig({ export default defineConfig({
plugins: [pluginVue()], plugins: [pluginVue()],
@ -160,7 +160,6 @@ export default defineConfig({
rspack: { rspack: {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -178,13 +177,12 @@ For Vite based projectconfigure the plugin in the `vite.config.js` file:
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite'; import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite'; import Components from 'unplugin-vue-components/vite';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default { export default {
plugins: [ plugins: [
vue(), vue(),
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -197,7 +195,7 @@ export default {
For vue-cli based projectconfigure the plugin in the `vue.config.js` file: For vue-cli based projectconfigure the plugin in the `vue.config.js` file:
```js ```js
const { VantResolver, VantImports } = require('@vant/auto-import-resolver'); const { VantResolver } = require('@vant/auto-import-resolver');
const AutoImport = require('unplugin-auto-import/webpack'); const AutoImport = require('unplugin-auto-import/webpack');
const Components = require('unplugin-vue-components/webpack'); const Components = require('unplugin-vue-components/webpack');
@ -205,11 +203,10 @@ module.exports = {
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
// When the version of unplugin-vue-components is less than 0.26.0: // When the version of unplugin-vue-components is less than 0.26.0:
AutoImport({ imports: [VantImports()], resolvers: [VantResolver()] }), AutoImport({ resolvers: [VantResolver()] }),
Components({ resolvers: [VantResolver()] }), Components({ resolvers: [VantResolver()] }),
// when the unplugin-vue-components version is greater than or equal to 0.26.0: // when the unplugin-vue-components version is greater than or equal to 0.26.0:
AutoImport.default({ AutoImport.default({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components.default({ resolvers: [VantResolver()] }), Components.default({ resolvers: [VantResolver()] }),
@ -221,18 +218,17 @@ module.exports = {
For webpack based projectconfigure the plugin in the `webpack.config.js` file: For webpack based projectconfigure the plugin in the `webpack.config.js` file:
```js ```js
const { VantResolver, VantImports } = require('@vant/auto-import-resolver'); const { VantResolver } = require('@vant/auto-import-resolver');
const AutoImport = require('unplugin-auto-import/webpack'); const AutoImport = require('unplugin-auto-import/webpack');
const Components = require('unplugin-vue-components/webpack'); const Components = require('unplugin-vue-components/webpack');
module.exports = { module.exports = {
plugins: [ plugins: [
// When the version of unplugin-vue-components is less than 0.26.0: // When the version of unplugin-vue-components is less than 0.26.0:
AutoImport({ imports: [VantImports()], resolvers: [VantResolver()] }), AutoImport({ resolvers: [VantResolver()] }),
Components({ resolvers: [VantResolver()] }), Components({ resolvers: [VantResolver()] }),
// when the unplugin-vue-components version is greater than or equal to 0.26.0: // when the unplugin-vue-components version is greater than or equal to 0.26.0:
AutoImport.default({ AutoImport.default({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components.default({ resolvers: [VantResolver()] }), Components.default({ resolvers: [VantResolver()] }),

View File

@ -174,7 +174,7 @@ import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVue } from '@rsbuild/plugin-vue';
import AutoImport from 'unplugin-auto-import/rspack'; import AutoImport from 'unplugin-auto-import/rspack';
import Components from 'unplugin-vue-components/rspack'; import Components from 'unplugin-vue-components/rspack';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default defineConfig({ export default defineConfig({
plugins: [pluginVue()], plugins: [pluginVue()],
@ -182,7 +182,6 @@ export default defineConfig({
rspack: { rspack: {
plugins: [ plugins: [
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -200,13 +199,12 @@ export default defineConfig({
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite'; import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite'; import Components from 'unplugin-vue-components/vite';
import { VantResolver, VantImports } from '@vant/auto-import-resolver'; import { VantResolver } from '@vant/auto-import-resolver';
export default { export default {
plugins: [ plugins: [
vue(), vue(),
AutoImport({ AutoImport({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components({ Components({
@ -219,7 +217,7 @@ export default {
如果是基于 vue-cli 的项目,在 `vue.config.js` 文件中配置插件: 如果是基于 vue-cli 的项目,在 `vue.config.js` 文件中配置插件:
```js ```js
const { VantResolver, VantImports } = require('@vant/auto-import-resolver'); const { VantResolver } = require('@vant/auto-import-resolver');
const AutoImport = require('unplugin-auto-import/webpack'); const AutoImport = require('unplugin-auto-import/webpack');
const Components = require('unplugin-vue-components/webpack'); const Components = require('unplugin-vue-components/webpack');
@ -227,11 +225,10 @@ module.exports = {
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
// 当 unplugin-vue-components 版本小于 0.26.0 时,使用以下写法 // 当 unplugin-vue-components 版本小于 0.26.0 时,使用以下写法
AutoImport({ imports: [VantImports()], resolvers: [VantResolver()] }), AutoImport({ resolvers: [VantResolver()] }),
Components({ resolvers: [VantResolver()] }), Components({ resolvers: [VantResolver()] }),
//当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法 //当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法
AutoImport.default({ AutoImport.default({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components.default({ resolvers: [VantResolver()] }), Components.default({ resolvers: [VantResolver()] }),
@ -243,18 +240,17 @@ module.exports = {
如果是基于 webpack 的项目,在 `webpack.config.js` 文件中配置插件: 如果是基于 webpack 的项目,在 `webpack.config.js` 文件中配置插件:
```js ```js
const { VantResolver, VantImports } = require('@vant/auto-import-resolver'); const { VantResolver } = require('@vant/auto-import-resolver');
const AutoImport = require('unplugin-auto-import/webpack'); const AutoImport = require('unplugin-auto-import/webpack');
const Components = require('unplugin-vue-components/webpack'); const Components = require('unplugin-vue-components/webpack');
module.exports = { module.exports = {
plugins: [ plugins: [
// 当 unplugin-vue-components 版本小于 0.26.0 时,使用以下写法 // 当 unplugin-vue-components 版本小于 0.26.0 时,使用以下写法
AutoImport({ imports: [VantImports()], resolvers: [VantResolver()] }), AutoImport({ resolvers: [VantResolver()] }),
Components({ resolvers: [VantResolver()] }), Components({ resolvers: [VantResolver()] }),
//当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法 //当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法
AutoImport.default({ AutoImport.default({
imports: [VantImports()],
resolvers: [VantResolver()], resolvers: [VantResolver()],
}), }),
Components.default({ resolvers: [VantResolver()] }), Components.default({ resolvers: [VantResolver()] }),