From d9fb9f72fe0f3b8744569fef04844733c1239d57 Mon Sep 17 00:00:00 2001 From: Laurent Payot Date: Tue, 21 Mar 2023 10:29:00 +0100 Subject: [PATCH 1/2] docs: build.target terser < 5.16 specific behaviour (#12506) --- config/build-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/build-options.md b/config/build-options.md index b9971fdb..ff4dbbd5 100644 --- a/config/build-options.md +++ b/config/build-options.md @@ -10,7 +10,7 @@ Browser compatibility target for the final bundle. The default value is a Vite s Another special value is `'esnext'` - which assumes native dynamic imports support and will transpile as little as possible: -- If the [`build.minify`](#build-minify) option is `'terser'`, `'esnext'` will be forced down to `'es2021'`. +- If the [`build.minify`](#build-minify) option is `'terser'` and the installed Terser version is below 5.16.0, `'esnext'` will be forced down to `'es2021'`. - In other cases, it will perform no transpilation at all. The transform is performed with esbuild and the value should be a valid [esbuild target option](https://esbuild.github.io/api/#target). Custom targets can either be an ES version (e.g. `es2015`), a browser with version (e.g. `chrome58`), or an array of multiple target strings. From 87f13b607aa50fa5c9b3bda47aa863eb05d2d4c6 Mon Sep 17 00:00:00 2001 From: waynzh Date: Wed, 22 Mar 2023 10:32:57 +0800 Subject: [PATCH 2/2] docs(cn): resolve conflicts --- config/build-options.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/config/build-options.md b/config/build-options.md index 034aeee8..a7ccb7b8 100644 --- a/config/build-options.md +++ b/config/build-options.md @@ -6,17 +6,12 @@ - **默认:** `'modules'` - **相关内容:** [浏览器兼容性](/guide/build#browser-compatibility) -设置最终构建的浏览器兼容目标。默认值是一个 Vite 特有的值:'modules'`,这是指 [支持原生 ES 模块](https://caniuse.com/es6-module)、[原生 ESM 动态导入](https://caniuse.com/es6-module-dynamic-import) 和 [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta) 的浏览器。Vite 将替换 `modules` 为 `['es2020', 'edge88', 'firefox78', 'chrome87', 'safari14']` +设置最终构建的浏览器兼容目标。默认值是一个 Vite 特有的值:`'modules'`,这是指 [支持原生 ES 模块](https://caniuse.com/es6-module)、[原生 ESM 动态导入](https://caniuse.com/es6-module-dynamic-import) 和 [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta) 的浏览器。Vite 将替换 `modules` 为 `['es2020', 'edge88', 'firefox78', 'chrome87', 'safari14']` 另一个特殊值是 “esnext” —— 即假设有原生动态导入支持,并且将会转译得尽可能小: -<<<<<<< HEAD -- 如果 [`build.minify`](#build-minify) 选项为 `'terser'`,`'esnext'` 将会强制降级为 `'es2021'`。 +- 如果 [`build.minify`](#build-minify) 选项为 `'terser'`,并且安装的 Terser 版本小于 5.16.0,`'esnext'` 将会强制降级为 `'es2021'`。 - 其他情况下将完全不会执行转译。 -======= -- If the [`build.minify`](#build-minify) option is `'terser'` and the installed Terser version is below 5.16.0, `'esnext'` will be forced down to `'es2021'`. -- In other cases, it will perform no transpilation at all. ->>>>>>> d9fb9f72fe0f3b8744569fef04844733c1239d57 转换过程将会由 esbuild 执行,并且此值应该是一个合法的 [esbuild 目标选项](https://esbuild.github.io/api/#target)。自定义目标也可以是一个 ES 版本(例如:`es2015`)、一个浏览器版本(例如:`chrome58`)或是多个目标组成的一个数组。