Skip to content

Commit

Permalink
fix: prioritize JS chunk in manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Nov 11, 2023
1 parent ed2be42 commit 1376a34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/src/node/plugins/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {
const assetMeta = fileNameToAssetMeta.get(chunk.fileName)
const src = assetMeta?.originalName ?? chunk.name
const asset = createAsset(chunk, src, assetMeta?.isEntry)

// If JS chunk and asset chunk are both generated from the same source file,
// prioritize JS chunk as it contains more information
if (manifest[src]?.file.endsWith('.js')) continue
manifest[src] = asset
fileNameToAsset.set(chunk.fileName, asset)
}
Expand Down

0 comments on commit 1376a34

Please sign in to comment.