Skip to content

Commit

Permalink
chore: mark stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 18, 2022
1 parent 6a37d15 commit b993f27
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ export default defineConfig({

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 `'es2019'`.
- If the [`build.minify`](#build-minify) option is `'terser'`, `'esnext'` will be forced down to `'es2019'`. <!-- mark -->
- 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 a ES version (e.g. `es2015`), a browser with version (e.g. `chrome58`), or an array of multiple target strings.
Expand Down
3 changes: 3 additions & 0 deletions docs/guide/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,8 @@ This pattern does not work if you are using Vite for Server-Side Rendering, beca
:::
::: warning Esbuild target config is necessary
<!-- mark -->
This pattern needs esbuild target to be set to `es2020` or higher. `vite@2.x` use `es2019` as default target. Set [build-target](https://vitejs.dev/config/#build-target) and [optimizedeps.esbuildoptions.target](https://vitejs.dev/config/#optimizedeps-esbuildoptions) to `es2020` or higher if you intend to use this partten.
:::
2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The production bundle assumes support for modern JavaScript. By default, Vite ta
defaults and supports es6-module and supports es6-module-dynamic-import, not opera > 0, not samsung > 0, not and_qq > 0
```

You can specify custom targets via the [`build.target` config option](/config/#build-target), where the lowest target is `es2015`.
You can specify custom targets via the [`build.target` config option](/config/#build-target), where the lowest target is `es2015`. <!-- mark -->

Note that by default, Vite only handles syntax transforms and **does not cover polyfills by default**. You can check out [Polyfill.io](https://polyfill.io/v3/) which is a service that automatically generates polyfill bundles based on the user's browser UserAgent string.

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export function resolveBuildOptions(raw?: BuildOptions): ResolvedBuildOptions {
]
} else if (resolved.target === 'esnext' && resolved.minify === 'terser') {
// esnext + terser: limit to es2019 so it can be minified by terser
resolved.target = 'es2019'
resolved.target = 'es2020'
}

if (!resolved.cssTarget) {
Expand Down

0 comments on commit b993f27

Please sign in to comment.