Skip to content

Commit

Permalink
fix: only remove entry assets handled by Vite core (#17916)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Sep 1, 2024
1 parent d428e7e commit ebfaa7e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/plugins/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
config.command === 'build' && this.getModuleInfo(id)?.isEntry
? 'no-treeshake'
: false,
meta: config.command === 'build' ? { 'vite:asset': true } : undefined,
}
},

Expand All @@ -230,7 +231,8 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
chunk.type === 'chunk' &&
chunk.isEntry &&
chunk.moduleIds.length === 1 &&
config.assetsInclude(chunk.moduleIds[0])
config.assetsInclude(chunk.moduleIds[0]) &&
this.getModuleInfo(chunk.moduleIds[0])?.meta['vite:asset']
) {
delete bundle[file]
}
Expand Down

0 comments on commit ebfaa7e

Please sign in to comment.