Skip to content

Identical output chunks should not have identical debug IDs #735

Open
@timfish

Description

@timfish

In our tests, we specifically vary the output chunk contents so that we don't end up with files with the same debug IDs:

// Just so the two bundles generate different hashes:
global.iAmBundle1 = 1;

// Just so the two bundles generate different hashes:
global.iAmBundle2 = 2;

It is possible to generate matching output chunks from wildly different input code which will in turn have different sourcemaps. If you consider transpiling, tree shaking and minimising, it's not safe to assume that identical output chunks should use the same sourcemaps.

The chances of this happening in real world usage is quite slim but we should consider it because it'll be very confusing if it does happen!

When adding debug ID support to bundlers, we included the output chunk name when creating the hash of the file. The bundlers already did this when generating filename hashes to avoid this very issue.

calculateDebugID(chunkName + outputSource)

This way we can be sure that every output chunk will have a unique debug ID, even if the output code is identical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions