Skip to content

Commit 918dd6d

Browse files
authored
docs: dev vs build target (#14997)
1 parent 3c92c7b commit 918dd6d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/guide/dep-pre-bundling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ A typical use case for `optimizeDeps.include` or `optimizeDeps.exclude` is when
6060

6161
Both `include` and `exclude` can be used to deal with this. If the dependency is large (with many internal modules) or is CommonJS, then you should include it; If the dependency is small and is already valid ESM, you can exclude it and let the browser load it directly.
6262

63-
You can further customize esbuild too with the [`optimizeDeps.esbuildOptions` option](/config/dep-optimization-options.md#optimizedeps-esbuildoptions). For example, adding an esbuild plugin to handle special files in dependencies.
63+
You can further customize esbuild too with the [`optimizeDeps.esbuildOptions` option](/config/dep-optimization-options.md#optimizedeps-esbuildoptions). For example, adding an esbuild plugin to handle special files in dependencies or changing the [build `target`](https://esbuild.github.io/api/#target).
6464

6565
## Caching
6666

docs/guide/index.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ You can learn more about the rationale behind the project in the [Why Vite](./wh
2020

2121
## Browser Support
2222

23-
The default build targets browsers that support [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta). Legacy browsers can be supported via the official [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) - see the [Building for Production](./build) section for more details.
23+
During development, Vite sets [`esnext` as the transform target](https://esbuild.github.io/api/#target), because we assume a modern browser is used and it supports all of the latest JavaScript and CSS features. This prevents syntax lowering, letting Vite serve modules as close as possible to the original source code.
24+
25+
For the production build, by default Vite targets browsers that support [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta). Legacy browsers can be supported via the official [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy). See the [Building for Production](./build) section for more details.
2426

2527
## Trying Vite Online
2628

0 commit comments

Comments
 (0)