From a092ee3ad6c170786afcecda6d761f309369a51b Mon Sep 17 00:00:00 2001 From: aisen60 Date: Thu, 6 Jan 2022 19:01:50 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20update=20document=20for=20=E2=80=9Cimpo?= =?UTF-8?q?rt=20on=20demand=20in=20vite=20projects=E2=80=9D=20(#10158)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vant/docs/markdown/quickstart.en-US.md | 19 ++++++++++--------- .../vant/docs/markdown/quickstart.zh-CN.md | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/vant/docs/markdown/quickstart.en-US.md b/packages/vant/docs/markdown/quickstart.en-US.md index 46ed3a006..da242d60d 100644 --- a/packages/vant/docs/markdown/quickstart.en-US.md +++ b/packages/vant/docs/markdown/quickstart.en-US.md @@ -99,7 +99,14 @@ If you are using vite, please use [vite-plugin-style-import](https://github.com/ #### 1. Install Plugin ```bash -npm i vite-plugin-style-import@1.2.0 -D +# with npm +npm i vite-plugin-style-import -D + +# with yarn +yarn add vite-plugin-style-import -D + +# with pnpm +pnpm add vite-plugin-style-import -D ``` #### 2. Configure Plugin @@ -108,19 +115,13 @@ Configure the plugin in the `vite.config.js` file: ```js import vue from '@vitejs/plugin-vue'; -import styleImport from 'vite-plugin-style-import'; +import styleImport, { VantResolve } from 'vite-plugin-style-import'; export default { plugins: [ vue(), styleImport({ - libs: [ - { - libraryName: 'vant', - esModule: true, - resolveStyle: (name) => `vant/es/${name}/style/index`, - }, - ], + resolves: [VantResolve()], }), ], }; diff --git a/packages/vant/docs/markdown/quickstart.zh-CN.md b/packages/vant/docs/markdown/quickstart.zh-CN.md index 933efc374..e33e68e02 100644 --- a/packages/vant/docs/markdown/quickstart.zh-CN.md +++ b/packages/vant/docs/markdown/quickstart.zh-CN.md @@ -100,7 +100,14 @@ pnpm add vant@3 #### 1. 安装插件 ```bash -npm i vite-plugin-style-import@1.2.0 -D +# 通过 npm 安装 +npm i vite-plugin-style-import -D + +# 通过 yarn 安装 +yarn add vite-plugin-style-import -D + +# 通过 pnpm 安装 +pnpm add vite-plugin-style-import -D ``` #### 2. 配置插件 @@ -109,19 +116,13 @@ npm i vite-plugin-style-import@1.2.0 -D ```js import vue from '@vitejs/plugin-vue'; -import styleImport from 'vite-plugin-style-import'; +import styleImport, { VantResolve } from 'vite-plugin-style-import'; export default { plugins: [ vue(), styleImport({ - libs: [ - { - libraryName: 'vant', - esModule: true, - resolveStyle: (name) => `vant/es/${name}/style/index`, - }, - ], + resolves: [VantResolve()], }), ], };