From 59d2eb277e0ee5659965c920b78c60aceadbeaf1 Mon Sep 17 00:00:00 2001 From: OneNail <31649110+OneNail@users.noreply.github.com> Date: Thu, 29 Jul 2021 00:11:35 +0800 Subject: [PATCH 01/22] docs: fix globalModulePaths type (#4420) --- config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/index.md b/config/index.md index 22405f2b..f19887a7 100644 --- a/config/index.md +++ b/config/index.md @@ -213,7 +213,7 @@ export default defineConfig(async ({ command, mode }) => { ```ts interface CSSModulesOptions { scopeBehaviour?: 'global' | 'local' - globalModulePaths?: string[] + globalModulePaths?: RegExp[] generateScopedName?: | string | ((name: string, filename: string, css: string) => string) From e3c7681a06ee2e74c8c68bc5f0d8cf233aacd132 Mon Sep 17 00:00:00 2001 From: patak Date: Thu, 29 Jul 2021 07:17:13 +0200 Subject: [PATCH 02/22] feat: modulepreload polyfill (#4058) --- config/index.md | 15 +++++++++++++++ guide/backend-integration.md | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/config/index.md b/config/index.md index f19887a7..edf90d49 100644 --- a/config/index.md +++ b/config/index.md @@ -543,6 +543,21 @@ createServer() Note the build will fail if the code contains features that cannot be safely transpiled by esbuild. See [esbuild docs](https://esbuild.github.io/content-types/#javascript) for more details. +### build.polyfillModulePreload + +- **Type:** `boolean` +- **Default:** `true` + + Whether to automatically inject [module preload polyfill](https://guybedford.com/es-module-preloading-integrity#modulepreload-polyfill). + + If set to `true`, the polyfill is auto injected into the proxy module of each `index.html` entry. If the build is configured to use a non-html custom entry via `build.rollupOptions.input`, then it is necessary to manually import the polyfill in your custom entry: + + ```js + import 'vite/modulepreload-polyfill' + ``` + + Note: the polyfill does **not** apply to [Library Mode](/guide/build#library-mode). If you need to support browsers without native dynamic import, you should probably avoid using it in your library. + ### build.outDir - **Type:** `string` diff --git a/guide/backend-integration.md b/guide/backend-integration.md index 0e03b9a7..fa35b51f 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -20,6 +20,13 @@ Or you can follow these steps to configure it manually: }) ``` + If you haven't disabled the [module preload polyfill](/config/#polyfillmodulepreload), you also need to import the polyfill in your entry + + ```js + // add the beginning of your app entry + import 'vite/modulepreload-polyfill' + ``` + 2. For development, inject the following in your server's HTML template (substitute `http://localhost:3000` with the local URL Vite is running at): ```html From 4c77d51afd6d42dfa096e70660d6f72343f962dc Mon Sep 17 00:00:00 2001 From: QC-L Date: Fri, 30 Jul 2021 13:50:00 +0800 Subject: [PATCH 03/22] docs(en): fix conflicts --- config/index.md | 18 +++++++----------- guide/backend-integration.md | 10 +++------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/config/index.md b/config/index.md index a9318794..0b66a9c3 100644 --- a/config/index.md +++ b/config/index.md @@ -543,26 +543,22 @@ createServer() 注意:如果代码包含不能被 `esbuild` 安全地编译的特性,那么构建将会失败。查看 [esbuild 文档](https://esbuild.github.io/content-types/#javascript) 获取更多细节。 -<<<<<<< HEAD -### build.outDir {#build-outdir} -======= -### build.polyfillModulePreload +### build.polyfillModulePreload {#build-polyfillmodulepreload} -- **Type:** `boolean` -- **Default:** `true` +- **类型:** `boolean` +- **默认值:** `true` - Whether to automatically inject [module preload polyfill](https://guybedford.com/es-module-preloading-integrity#modulepreload-polyfill). + 用于决定是否自动注入 [module preload 的 polyfill](https://guybedford.com/es-module-preloading-integrity#modulepreload-polyfill). - If set to `true`, the polyfill is auto injected into the proxy module of each `index.html` entry. If the build is configured to use a non-html custom entry via `build.rollupOptions.input`, then it is necessary to manually import the polyfill in your custom entry: + 如果设置为 `true`,此 polyfill 会被自动注入到每个 `index.html` 入口的 proxy 模块中。如果是通过 `build.rollupOptions.input` 将构建配置为使用非 html 的自定义入口,那么则需要在你自定义入口中手动引入 polyfill: ```js import 'vite/modulepreload-polyfill' ``` - Note: the polyfill does **not** apply to [Library Mode](/guide/build#library-mode). If you need to support browsers without native dynamic import, you should probably avoid using it in your library. + 注意:此 polyfill **不适用于** [Library 模式](/guide/build#library-mode)。如果你需要支持不支持动态引入的浏览器,你应该避免在你的库中使用此选项。 -### build.outDir ->>>>>>> e3c7681a06ee2e74c8c68bc5f0d8cf233aacd132 +### build.outDir {#build-outdir} - **类型:** `string` - **默认:** `dist` diff --git a/guide/backend-integration.md b/guide/backend-integration.md index 815cb8b3..aedc7c7e 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -20,18 +20,14 @@ }) ``` -<<<<<<< HEAD -2. 在开发环境中,在服务器的 HTML 模板中注入以下内容(用正在运行的本地 URL 替换 `http://localhost:3000`): -======= - If you haven't disabled the [module preload polyfill](/config/#polyfillmodulepreload), you also need to import the polyfill in your entry + 如果你没有禁用 [module preload 的 polyfill](/config/#polyfillmodulepreload),你还需在你的入口处添加此 polyfill: ```js - // add the beginning of your app entry + // 在你应用的入口起始处添加此 polyfill import 'vite/modulepreload-polyfill' ``` -2. For development, inject the following in your server's HTML template (substitute `http://localhost:3000` with the local URL Vite is running at): ->>>>>>> e3c7681a06ee2e74c8c68bc5f0d8cf233aacd132 +2. 在开发环境中,在服务器的 HTML 模板中注入以下内容(用正在运行的本地 URL 替换 `http://localhost:3000`): ```html From fb8dca6894ae839a33bab4946919465e292e8d0d Mon Sep 17 00:00:00 2001 From: taisei mima Date: Fri, 30 Jul 2021 17:17:28 +0900 Subject: [PATCH 04/22] chore: typo (#4445) --- config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/index.md b/config/index.md index edf90d49..408fa4a0 100644 --- a/config/index.md +++ b/config/index.md @@ -78,7 +78,7 @@ export default defineConfig(async ({ command, mode }) => { return { // build specific config } -} +}) ``` ## Shared Options From e94a32846f89280f79628275638e667c6955513a Mon Sep 17 00:00:00 2001 From: Zahin Afsar <43959210+zahinafsar@users.noreply.github.com> Date: Mon, 2 Aug 2021 00:51:11 +0600 Subject: [PATCH 05/22] chore: typo in vite 2 announcement post (#4465) --- blog/announcing-vite2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/announcing-vite2.md b/blog/announcing-vite2.md index b44b3c35..0bf520df 100644 --- a/blog/announcing-vite2.md +++ b/blog/announcing-vite2.md @@ -46,7 +46,7 @@ Vite treats CSS as a first-class citizen of the module graph and supports the fo ### Server-Side Rendering (SSR) Support -Vite 2.0 ships with [experimental SSR support](https://vitejs.dev/guide/ssr.html). Vite provides APIs to to efficiently load and update ESM-based source code in Node.js during development (almost like server-side HMR), and automatically externalizes CommonJS-compatible dependencies to improve development and SSR build speed. The production server can be completely decoupled from Vite, and the same setup can be easily adapted to perform pre-rendering / SSG. +Vite 2.0 ships with [experimental SSR support](https://vitejs.dev/guide/ssr.html). Vite provides APIs to efficiently load and update ESM-based source code in Node.js during development (almost like server-side HMR), and automatically externalizes CommonJS-compatible dependencies to improve development and SSR build speed. The production server can be completely decoupled from Vite, and the same setup can be easily adapted to perform pre-rendering / SSG. Vite SSR is provided as a low-level feature and we are expecting to see higher level frameworks leveraging it under the hood. From 4eb82a8843fee892588def29a70ce3eb3fa799bf Mon Sep 17 00:00:00 2001 From: QC-L Date: Mon, 2 Aug 2021 10:24:34 +0800 Subject: [PATCH 06/22] docs(en): fix conflicts --- blog/announcing-vite2.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/blog/announcing-vite2.md b/blog/announcing-vite2.md index 8a10375c..35f1d0c4 100644 --- a/blog/announcing-vite2.md +++ b/blog/announcing-vite2.md @@ -46,11 +46,7 @@ Vite 将 CSS 看作模块系统中的一等公民,并且内置了以下支持 ### 服务端渲染(SSR)支持 {#server-side-rendering-ssr-support} -<<<<<<< HEAD -Vite 2.0 提供 [实验性的 SSR 支持](/guide/ssr)。Vite 提供一个灵活的 API 来在 Node.js 中高效率地直接加载 ESM 源码(并且同样有精准的更新而不需要打包)。提供 CommonJS 版本的依赖会在 SSR 时自动被跳过转换直接加载。生产环境下,服务器可以和 Vite 完全解耦。基于 Vite SSR 的架构也可以很方便的做静态预渲染(SSG)。 -======= -Vite 2.0 ships with [experimental SSR support](https://vitejs.dev/guide/ssr.html). Vite provides APIs to efficiently load and update ESM-based source code in Node.js during development (almost like server-side HMR), and automatically externalizes CommonJS-compatible dependencies to improve development and SSR build speed. The production server can be completely decoupled from Vite, and the same setup can be easily adapted to perform pre-rendering / SSG. ->>>>>>> e94a32846f89280f79628275638e667c6955513a +Vite 2.0 提供 [实验性的 SSR 支持](/guide/ssr)。Vite 提供了灵活的 API,以便于在开发过程中直接通过 Node.js 高效率地加载和更新 ESM 的源码(几乎与服务端的 HMR 一致),并自动外部化与 CommonJS 兼容的依赖关系,以提高开发和 SSR 的构建速度。生产环境下,服务器可以和 Vite 完全解耦。基于 Vite SSR 的架构也可以很方便的做静态预渲染(SSG)。 Vite SSR 会作为一个底层功能,而我们期待看到更高层级的框架在此基础上的应用。 From ec2ede7888c1d6b453325d49ad59bbae38edb80e Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 2 Aug 2021 23:24:10 +0800 Subject: [PATCH 07/22] docs: add a note on how to fix WSL2 watch issues (#4478) --- config/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/index.md b/config/index.md index 408fa4a0..03927c33 100644 --- a/config/index.md +++ b/config/index.md @@ -453,6 +453,8 @@ export default defineConfig(async ({ command, mode }) => { File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar#api). + When running Vite on Windows Subsystem for Linux (WSL) 2, if the project folder resides in a Windows filesystem, you'll need to set this option to `{ usePolling: true }`. This is due to [a WSL2 limitation](https://github.com/microsoft/WSL/issues/4739) with the Windows filesystem. + ### server.middlewareMode - **Type:** `'ssr' | 'html'` From 534dd8bbc249b23bbc3fdc9d2d1a2c5a3fccd715 Mon Sep 17 00:00:00 2001 From: QC-L Date: Tue, 3 Aug 2021 11:22:53 +0800 Subject: [PATCH 08/22] docs(en): fix conflicts --- config/index.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/config/index.md b/config/index.md index 6cf4ccbb..c2edfcce 100644 --- a/config/index.md +++ b/config/index.md @@ -453,13 +453,9 @@ export default defineConfig(async ({ command, mode }) => { 传递给 [chokidar](https://github.com/paulmillr/chokidar#api) 的文件系统监听器选项。 -<<<<<<< HEAD -### server.middlewareMode {#server-middlewaremode} -======= - When running Vite on Windows Subsystem for Linux (WSL) 2, if the project folder resides in a Windows filesystem, you'll need to set this option to `{ usePolling: true }`. This is due to [a WSL2 limitation](https://github.com/microsoft/WSL/issues/4739) with the Windows filesystem. + 当需要再 Windows Subsystem for Linux (WSL) 2 上运行 Vite 时,如果项目文件夹位于 Windows 文件系统中,你需要将此选项设置为 `{ usePolling: true }`。这是由于 Windows 文件系统的 [WSL2 限制](https://github.com/microsoft/WSL/issues/4739) 造成的。 -### server.middlewareMode ->>>>>>> ec2ede7888c1d6b453325d49ad59bbae38edb80e +### server.middlewareMode {#server-middlewaremode} - **类型:** `'ssr' | 'html'` From 0735cb40cfcf52dc26bc9b955bab7f7633bbf8e1 Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 3 Aug 2021 14:50:53 +0800 Subject: [PATCH 09/22] docs: Fix the confusing example of `server.proxy` (#4485) --- config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/index.md b/config/index.md index 03927c33..0b8471e2 100644 --- a/config/index.md +++ b/config/index.md @@ -396,7 +396,7 @@ export default defineConfig(async ({ command, mode }) => { server: { proxy: { // string shorthand - '/foo': 'http://localhost:4567/foo', + '/foo': 'http://localhost:4567', // with options '/api': { target: 'http://jsonplaceholder.typicode.com', From 7023cd5e113df579018a07a82b45a994c865b66f Mon Sep 17 00:00:00 2001 From: QC-L Date: Wed, 4 Aug 2021 10:25:13 +0800 Subject: [PATCH 10/22] docs(en): fix conflicts --- config/index.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/config/index.md b/config/index.md index fe511882..54ac1f50 100644 --- a/config/index.md +++ b/config/index.md @@ -395,15 +395,9 @@ export default defineConfig(async ({ command, mode }) => { export default defineConfig({ server: { proxy: { -<<<<<<< HEAD // 字符串简写写法 - '/foo': 'http://localhost:4567/foo', - // 选项写法 -======= - // string shorthand '/foo': 'http://localhost:4567', - // with options ->>>>>>> 0735cb40cfcf52dc26bc9b955bab7f7633bbf8e1 + // 选项写法 '/api': { target: 'http://jsonplaceholder.typicode.com', changeOrigin: true, From 745b9784b8bfbbfeecceec87a47033abaab1fd5c Mon Sep 17 00:00:00 2001 From: Hermann Stanew Date: Fri, 6 Aug 2021 09:39:01 +0200 Subject: [PATCH 11/22] docs: indentation in code block (#4522) --- guide/static-deploy.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/static-deploy.md b/guide/static-deploy.md index 5bf5668a..e8d9cc9b 100644 --- a/guide/static-deploy.md +++ b/guide/static-deploy.md @@ -188,9 +188,9 @@ You can also run the above script in your CI setup to enable automatic deploymen ```js { - "projects": { - "default": "" - } + "projects": { + "default": "" + } } ``` From e750dbb5a6d340221c8c0e238b72e8636436317f Mon Sep 17 00:00:00 2001 From: patak Date: Fri, 6 Aug 2021 10:46:34 +0200 Subject: [PATCH 12/22] docs: make link to existing integrations more prominent (#4525) --- guide/backend-integration.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guide/backend-integration.md b/guide/backend-integration.md index fa35b51f..ac09692a 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -1,8 +1,10 @@ # Backend Integration +:::tip Note If you want to serve the HTML using a traditional backend (e.g. Rails, Laravel) but use Vite for serving assets, check for existing integrations listed in [Awesome Vite](https://github.com/vitejs/awesome-vite#integrations-with-backends). -Or you can follow these steps to configure it manually: +If you need a custom integration, you can follow the steps in this guide to configure it manually +::: 1. In your Vite config, configure the entry and enable build manifest: From 19d42b16cc21135f2144793a6d4f7f7e3ab7b51b Mon Sep 17 00:00:00 2001 From: QC-L Date: Sat, 7 Aug 2021 17:53:19 +0800 Subject: [PATCH 13/22] docs(en): fix conflicts --- guide/backend-integration.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/guide/backend-integration.md b/guide/backend-integration.md index 7166fe7b..6810587a 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -1,16 +1,10 @@ # 后端集成 {#backend-integration} -<<<<<<< HEAD -如果你想使用传统的后端(如 Rails, Laravel)来服务 HTML,但使用 Vite 来服务其他资源,可以查看在 [Awesome Vite](https://github.com/vitejs/awesome-vite#integrations-with-backends) 上的已有的后端集成列表。 - -或者你可以按照如下步骤手动配置: -======= :::tip Note -If you want to serve the HTML using a traditional backend (e.g. Rails, Laravel) but use Vite for serving assets, check for existing integrations listed in [Awesome Vite](https://github.com/vitejs/awesome-vite#integrations-with-backends). +如果你想使用传统的后端(如 Rails, Laravel)来服务 HTML,但使用 Vite 来服务其他资源,可以查看在 [Awesome Vite](https://github.com/vitejs/awesome-vite#integrations-with-backends) 上的已有的后端集成列表。 -If you need a custom integration, you can follow the steps in this guide to configure it manually +如果你需要自定义集成,你可以按照本指南的步骤配置它: ::: ->>>>>>> e750dbb5a6d340221c8c0e238b72e8636436317f 1. 在你的 Vite 配置中配置入口文件和启用创建 `manifest`: From 58bf7412d6187c6d411d93787d8d80ef74dc75e6 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Mon, 9 Aug 2021 07:20:04 +0200 Subject: [PATCH 14/22] chore(docs): improve gitlab pages deployment (#4534) --- guide/static-deploy.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/guide/static-deploy.md b/guide/static-deploy.md index e8d9cc9b..e3ba7665 100644 --- a/guide/static-deploy.md +++ b/guide/static-deploy.md @@ -138,24 +138,28 @@ You can also run the above script in your CI setup to enable automatic deploymen If you are deploying to `https://.gitlab.io//`, for example your repository is at `https://gitlab.com//`, then set `base` to `'//'`. -2. Set `build.outDir` in `vite.config.js` to `public`. - -3. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content: +2. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content: ```yaml - image: node:10.22.0 + image: node:16.5.0 pages: + stage: deploy cache: + key: + files: + - package-lock.json + prefix: npm paths: - node_modules/ script: - npm install - npm run build + - cp -a dist/. public/ artifacts: paths: - public - only: - - master + rules: + - $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ``` ## Netlify From a2080c8e1a2d6aec1aefd47a6e10b8276a138867 Mon Sep 17 00:00:00 2001 From: QC-L Date: Tue, 10 Aug 2021 12:00:44 +0800 Subject: [PATCH 15/22] docs(en): fix conflicts --- guide/static-deploy.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/guide/static-deploy.md b/guide/static-deploy.md index ad45e009..12073248 100644 --- a/guide/static-deploy.md +++ b/guide/static-deploy.md @@ -138,13 +138,7 @@ $ npm run preview 如果你要部署在 `https://.gitlab.io//` 上,例如你的仓库地址为 `https://gitlab.com//`,那么请设置 `base` 为 `'//'`。 -<<<<<<< HEAD -2. 在 `vite.config.js` 中设置 `build.outDir` 为 `public`。 - -3. 在项目根目录创建一个 `.gitlab-ci.yml` 文件,并包含以下内容。它将使得每次你更改内容时都重新构建与部署站点: -======= -2. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content: ->>>>>>> 58bf7412d6187c6d411d93787d8d80ef74dc75e6 +2. 在项目根目录创建一个 `.gitlab-ci.yml` 文件,并包含以下内容。它将使得每次你更改内容时都重新构建与部署站点: ```yaml image: node:16.5.0 From 34086fffda5c67fcebfc0d23f23ffafa9faf3e54 Mon Sep 17 00:00:00 2001 From: Jun Shindo <46585162+jay-es@users.noreply.github.com> Date: Thu, 12 Aug 2021 00:58:27 +0900 Subject: [PATCH 16/22] chore(docs): fix internal links (#4579) --- guide/backend-integration.md | 2 +- guide/migration.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/backend-integration.md b/guide/backend-integration.md index ac09692a..06fbce48 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -22,7 +22,7 @@ If you need a custom integration, you can follow the steps in this guide to conf }) ``` - If you haven't disabled the [module preload polyfill](/config/#polyfillmodulepreload), you also need to import the polyfill in your entry + If you haven't disabled the [module preload polyfill](/config/#build-polyfillmodulepreload), you also need to import the polyfill in your entry ```js // add the beginning of your app entry diff --git a/guide/migration.md b/guide/migration.md index 3854c9d5..e3707f35 100644 --- a/guide/migration.md +++ b/guide/migration.md @@ -32,13 +32,13 @@ - `httpsOptions` has been removed. [`server.https`](/config/#server-https) can directly accept the options object. - `chokidarWatchOptions` is now [`server.watch`](/config/#server-watch). -- [`assetsInclude`](/config/#assetsInclude) now expects `string | RegExp | (string | RegExp)[]` instead of a function. +- [`assetsInclude`](/config/#assetsinclude) now expects `string | RegExp | (string | RegExp)[]` instead of a function. - All Vue specific options are removed; Pass options to the Vue plugin instead. ## Alias Behavior Change -[`alias`](/config/#alias) is now being passed to `@rollup/plugin-alias` and no longer require start/ending slashes. The behavior is now a direct replacement, so 1.0-style directory alias key should remove the ending slash: +[`alias`](/config/#resolve-alias) is now being passed to `@rollup/plugin-alias` and no longer require start/ending slashes. The behavior is now a direct replacement, so 1.0-style directory alias key should remove the ending slash: ```diff - alias: { '/@foo/': path.resolve(__dirname, 'some-special-dir') } From 79d8b2c92730fd237d92ec9e97006b12e8611085 Mon Sep 17 00:00:00 2001 From: Yadhunandan S Date: Sat, 14 Aug 2021 07:03:11 +0530 Subject: [PATCH 17/22] docs: Removed an unwanted closing parenthesis (#4599) --- config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/index.md b/config/index.md index 0b8471e2..e980f7ef 100644 --- a/config/index.md +++ b/config/index.md @@ -415,7 +415,7 @@ export default defineConfig(async ({ command, mode }) => { changeOrigin: true, configure: (proxy, options) => { // proxy will be an instance of 'http-proxy' - }), + }, } } } From 807e1f8f59dfc77875687ff3bef78233257fb72d Mon Sep 17 00:00:00 2001 From: rhan <34862686+yaiks@users.noreply.github.com> Date: Fri, 13 Aug 2021 22:42:30 -0300 Subject: [PATCH 18/22] docs: removing duplicate line on using-plugins page (#4601) --- guide/using-plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/using-plugins.md b/guide/using-plugins.md index 00f1082f..ca4faf9d 100644 --- a/guide/using-plugins.md +++ b/guide/using-plugins.md @@ -36,7 +36,7 @@ Vite aims to provide out-of-the-box support for common web development patterns. Check out the [Plugins section](../plugins/) for information about official plugins. Community plugins are listed in [awesome-vite](https://github.com/vitejs/awesome-vite#plugins). For compatible Rollup plugins, check out [Vite Rollup Plugins](https://vite-rollup-plugins.patak.dev) for a list of compatible official Rollup plugins with usage instructions or the [Rollup Plugin Compatibility section](../guide/api-plugin#rollup-plugin-compatibility) in case it is not listed there. -You can also find plugins that follow the [recommended conventions](./api-plugin.md#conventions) using a [npm search for vite-plugin](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) for Vite plugins or a [npm search for rollup-plugin](https://www.npmjs.com/search?q=rollup-plugin&ranking=popularity) or a [npm search for vite-plugin](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) for Rollup plugins. +You can also find plugins that follow the [recommended conventions](./api-plugin.md#conventions) using a [npm search for vite-plugin](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) for Vite plugins or a [npm search for rollup-plugin](https://www.npmjs.com/search?q=rollup-plugin&ranking=popularity) for Rollup plugins. ## Enforcing Plugin Ordering From 0d337fe033f22056e00aa7335cff09a5e0e05707 Mon Sep 17 00:00:00 2001 From: ShenQingchuan Date: Sat, 14 Aug 2021 15:02:41 +0800 Subject: [PATCH 19/22] docs(cn): fix all conflicts. --- guide/backend-integration.md | 6 +----- guide/migration.md | 12 ++---------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/guide/backend-integration.md b/guide/backend-integration.md index 35fa5a0a..d0fc50d2 100644 --- a/guide/backend-integration.md +++ b/guide/backend-integration.md @@ -22,11 +22,7 @@ }) ``` -<<<<<<< HEAD - 如果你没有禁用 [module preload 的 polyfill](/config/#polyfillmodulepreload),你还需在你的入口处添加此 polyfill: -======= - If you haven't disabled the [module preload polyfill](/config/#build-polyfillmodulepreload), you also need to import the polyfill in your entry ->>>>>>> 34086fffda5c67fcebfc0d23f23ffafa9faf3e54 + 如果你没有禁用 [module preload 的 polyfill](/config/#build-polyfillmodulepreload),你还需在你的入口处添加此 polyfill: ```js // 在你应用的入口起始处添加此 polyfill diff --git a/guide/migration.md b/guide/migration.md index 70e57762..2254fe5a 100644 --- a/guide/migration.md +++ b/guide/migration.md @@ -31,21 +31,13 @@ - `httpsOptions` 已被删除,[`server.https`](/config/#server-https) 可以直接接收选项对象。 - `chokidarWatchOptions` 变更为 [`server.watch`](/config/#server-watch)。 -<<<<<<< HEAD -- [`assetsInclude`](/config/#assetsInclude) 现在接收 `string | RegExp | (string | RegExp)[]` 而不是一个函数。 -======= -- [`assetsInclude`](/config/#assetsinclude) now expects `string | RegExp | (string | RegExp)[]` instead of a function. ->>>>>>> 34086fffda5c67fcebfc0d23f23ffafa9faf3e54 +- [`assetsInclude`](/config/#assetsinclude) 现在接收 `string | RegExp | (string | RegExp)[]` 而不是一个函数。 - 所有 Vue 特定选项都已移除;应将选项传递给 Vue 插件。 ## 别名用法变化 {#alias-behavior-change} -<<<<<<< HEAD -[`alias`](/config/#alias) 现在会被传递给 `@rollup/plugin-alias` 并不再需要开始/结尾处的斜线了。此行为目前是一个直接替换,所以 1.0 风格的目录别名需要删除其结尾处的斜线: -======= -[`alias`](/config/#resolve-alias) is now being passed to `@rollup/plugin-alias` and no longer require start/ending slashes. The behavior is now a direct replacement, so 1.0-style directory alias key should remove the ending slash: ->>>>>>> 34086fffda5c67fcebfc0d23f23ffafa9faf3e54 +[`alias`](/config/#resolve-alias) 现在会被传递给 `@rollup/plugin-alias` 并不再需要开始/结尾处的斜线了。此行为目前是一个直接替换,所以 1.0 风格的目录别名需要删除其结尾处的斜线: ```diff - alias: { '/@foo/': path.resolve(__dirname, 'some-special-dir') } From d3fd909f5f810b76957ee3a9c4a5cff60238500a Mon Sep 17 00:00:00 2001 From: ShenQingchuan Date: Sat, 14 Aug 2021 18:39:39 +0800 Subject: [PATCH 20/22] feat: href directives support (close #225) --- .vitepress/theme/index.js | 9 +++++++++ guide/assets.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.vitepress/theme/index.js b/.vitepress/theme/index.js index 3cedb624..bf23b430 100644 --- a/.vitepress/theme/index.js +++ b/.vitepress/theme/index.js @@ -33,5 +33,14 @@ export default { ) ]) }) + }, + enhanceApp({ app, router, siteData }) { + // app is the Vue 3 app instance from `createApp()`. router is VitePress' + // custom router. `siteData`` is a `ref`` of current site-level metadata. + app.directive('href', { + mounted(el, binding) { + el.href = binding.value; + } + }) } } diff --git a/guide/assets.md b/guide/assets.md index 5cb47eeb..b1b9fb3f 100644 --- a/guide/assets.md +++ b/guide/assets.md @@ -85,7 +85,7 @@ import InlineWorker from './shader.js?worker&inline' ## new URL(url, import.meta.url) -[import.meta.url](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta) 是一个 ESM 的原生功能,会暴露当前模块的 URL。将它与原生的 [URL 构造器](https://developer.mozilla.org/en-US/docs/Web/API/URL) 组合使用,在一个 JavaScript 模块中,通过相对路径我们就能得到一个被完整解析的静态资源 URL: +import.meta.url 是一个 ESM 的原生功能,会暴露当前模块的 URL。将它与原生的 [URL 构造器](https://developer.mozilla.org/en-US/docs/Web/API/URL) 组合使用,在一个 JavaScript 模块中,通过相对路径我们就能得到一个被完整解析的静态资源 URL: ```js const imgUrl = new URL('./img.png', import.meta.url) From 6f5cfd8ccaf41b248ac77c84192db3424873304b Mon Sep 17 00:00:00 2001 From: QC-L Date: Mon, 16 Aug 2021 15:00:55 +0800 Subject: [PATCH 21/22] docs(en): fix conflicts --- config/index.md | 4 ---- guide/using-plugins.md | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/config/index.md b/config/index.md index 20722b93..54ac1f50 100644 --- a/config/index.md +++ b/config/index.md @@ -414,11 +414,7 @@ export default defineConfig(async ({ command, mode }) => { target: 'http://jsonplaceholder.typicode.com', changeOrigin: true, configure: (proxy, options) => { -<<<<<<< HEAD // proxy 是 'http-proxy' 的实例 -======= - // proxy will be an instance of 'http-proxy' ->>>>>>> 807e1f8f59dfc77875687ff3bef78233257fb72d }, } } diff --git a/guide/using-plugins.md b/guide/using-plugins.md index 00704087..a776d124 100644 --- a/guide/using-plugins.md +++ b/guide/using-plugins.md @@ -36,11 +36,7 @@ Vite 旨在为常见的 Web 开发范式提供开箱即用的支持。在寻找 查看 [Plugins 章节](../plugins/) 获取官方插件信息。社区插件列表请参见 [awesome-vite](https://github.com/vitejs/awesome-vite#plugins)。而对于兼容的 Rollup 插件,请查看 [Vite Rollup 插件](https://vite-rollup-plugins.patak.dev) 获取一个带使用说明的兼容 Rollup 官方插件列表,若列表中没有找到,则请参阅 [Rollup 插件兼容性章节](../guide/api-plugin#rollup-plugin-compatibility)。 -<<<<<<< HEAD -你也可以使用此 [npm Vite 插件搜索链接](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) 来找到一些遵循了 [推荐约定](./api-plugin.md#conventions) 的 Vite 插件,或者此 [npm Rollup 插件搜索链接](https://www.npmjs.com/search?q=rollup-plugin&ranking=popularity) 获取 Rollup 插件。 -======= -You can also find plugins that follow the [recommended conventions](./api-plugin.md#conventions) using a [npm search for vite-plugin](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) for Vite plugins or a [npm search for rollup-plugin](https://www.npmjs.com/search?q=rollup-plugin&ranking=popularity) for Rollup plugins. ->>>>>>> 807e1f8f59dfc77875687ff3bef78233257fb72d +你也可以使用此 [npm Vite 插件搜索链接](https://www.npmjs.com/search?q=vite-plugin&ranking=popularity) 来找到一些遵循了 [推荐约定](./api-plugin.md#conventions) 的 Vite 插件,或者通过 [npm Rollup 插件搜索链接](https://www.npmjs.com/search?q=rollup-plugin&ranking=popularity) 获取 Rollup 插件。 ## 强制插件排序 {#enforcing-plugin-ordering} From defec8048f5362b78f4d802b6f298f897dd837d1 Mon Sep 17 00:00:00 2001 From: QC-L Date: Mon, 16 Aug 2021 16:02:05 +0800 Subject: [PATCH 22/22] fix: directive build error in ssr mode --- package.json | 1 + yarn.lock | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/package.json b/package.json index 9e13fb9d..90fb2c6b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "private": true, "devDependencies": { "chalk": "^4.1.0", + "patch-vue-directive-ssr": "^0.0.1", "vitepress": "^0.12.2", "yorkie": "^2.0.0" }, diff --git a/yarn.lock b/yarn.lock index f16545e3..8f69ae1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1057,6 +1057,11 @@ p-finally@^1.0.0: resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= +patch-vue-directive-ssr@^0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/patch-vue-directive-ssr/-/patch-vue-directive-ssr-0.0.1.tgz#2eac731f59cdb766d4d613bc24e522ded6ff1bb8" + integrity sha512-n84llktHah+EXUGo+RvmTJcAQJQVW0kHHHiJ34ZSLijzhHi32zCMjCc5VAFv4jmdC91bpaYGPk0cDW1D8hQ3GQ== + path-key@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"