Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define mappings that can be ignored when generating source map #49

Open
jridgewell opened this issue Aug 9, 2023 · 1 comment
Open

Comments

@jridgewell
Copy link
Member

jridgewell commented Aug 9, 2023

Occasionally, a mapping is generated that contains essentially the exact same information as the mapping immediately before it:

CCCC,AAAA

This defines two mappings, both of which point to the same exact spot in the original source file. This isn't necessary, and adding the second just bloats the source map.

I've defined a couple of more "useless" mappings in https://github.com/jridgewell/gen-mapping/blob/7626d310002df682012dc29bdfa4d674027f1538/src/gen-mapping.ts#L382-L418, which is exposed to the generating tool through maybeAddMapping (Babel and Terser use this). It'd be good to formally define which mappings are duplicates and can be removed when generating a source map.

@sjrd
Copy link

sjrd commented Aug 9, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants