Skip to content

Commit

Permalink
fix: skip not only .js but also .mjs manifest entries (#15841)
Browse files Browse the repository at this point in the history
Co-authored-by: patak <[email protected]>
  • Loading branch information
brillout and patak-dev authored Feb 8, 2024
1 parent 9da6502 commit 3d860e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vite/src/node/plugins/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { normalizePath, sortObjectKeys } from '../utils'
import { generatedAssets } from './asset'
import type { GeneratedAssetMeta } from './asset'

const endsWithJSRE = /\.[cm]?js$/

export type Manifest = Record<string, ManifestChunk>

export interface ManifestChunk {
Expand Down Expand Up @@ -134,7 +136,9 @@ export function manifestPlugin(config: ResolvedConfig): Plugin {

// 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
const file = manifest[src]?.file
if (file && endsWithJSRE.test(file)) continue

manifest[src] = asset
fileNameToAsset.set(chunk.fileName, asset)
}
Expand Down

0 comments on commit 3d860e7

Please sign in to comment.