mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
feat(dev): support keepNames option for optimizeDependencies config (#2742)
This commit is contained in:
parent
38466d1248
commit
130bf5a03a
@ -569,6 +569,15 @@ export default ({ command, mode }) => {
|
||||
|
||||
By default, linked packages not inside `node_modules` are not pre-bundled. Use this option to force a linked package to be pre-bundled.
|
||||
|
||||
### optimizeDeps.keepNames
|
||||
|
||||
- **Type:** `boolean`
|
||||
- **Default:** `false`
|
||||
|
||||
The bundler sometimes needs to rename symbols to avoid collisions.
|
||||
Set this to `true` to keep the `name` property on functions and classes.
|
||||
See [`keepNames`](https://esbuild.github.io/api/#keep-names).
|
||||
|
||||
## SSR Options
|
||||
|
||||
:::warning Experimental
|
||||
|
@ -46,6 +46,12 @@ export interface DepOptimizationOptions {
|
||||
* cannot be globs).
|
||||
*/
|
||||
exclude?: string[]
|
||||
/**
|
||||
* The bundler sometimes needs to rename symbols to avoid collisions.
|
||||
* Set this to `true` to keep the `name` property on functions and classes.
|
||||
* https://esbuild.github.io/api/#keep-names
|
||||
*/
|
||||
keepNames?: boolean
|
||||
}
|
||||
|
||||
export interface DepOptimizationMetadata {
|
||||
@ -229,7 +235,7 @@ export async function optimizeDeps(
|
||||
const result = await build({
|
||||
entryPoints: Object.keys(flatIdDeps),
|
||||
bundle: true,
|
||||
keepNames: true,
|
||||
keepNames: config.optimizeDeps?.keepNames,
|
||||
format: 'esm',
|
||||
external: config.optimizeDeps?.exclude,
|
||||
logLevel: 'error',
|
||||
|
Loading…
Reference in New Issue
Block a user