Skip to content

Chunk conflict without [hash] in chunkNames #4411

@ocavue

Description

@ocavue

When I have two chunk files with the same text content, and I explicitly don't add [hash] in chunkNames, these two chunk files are merged into one file unexpectedly.

Minimal reproduction: https://github.com/issueset/esbuild-chunk-hash-issue

Current behavior: esbuild outputs only one chunk file

./dist/esbuild ├── chunk │   └── chunk.js └── entry ├── entry-a1.js ├── entry-a2.js ├── entry-b1.js └── entry-b2.js 

Expected behavior 1: esbuild should output two chunk files with different file names like what rollup does:

./dist/rollup ├── chunk │   ├── shared.js │   └── shared2.js └── entry ├── entry-a1.js ├── entry-a2.js ├── entry-b1.js └── entry-b2.js 

Expected behavior 2: Alternatively, esbuild can throw an error indicating that src/shared-a/shared.js and src/shared-b/shared.js share the same output path, but they should not merge into the same file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions