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

Exclude JSON from sourcemaps #3878

Open
znewsham opened this issue Aug 14, 2024 · 2 comments
Open

Exclude JSON from sourcemaps #3878

znewsham opened this issue Aug 14, 2024 · 2 comments

Comments

@znewsham
Copy link

I'm trying to exclude JSON files from sourcemaps - I've already looked at #1685 and implemented the suggested solution - however this only works for JS files as you can't append a comment to a JSON file (esbuild complains about this if I do add the comment). Unfortunately these files are still added to the client sourcemap, making it quite large.

Is there a way to exclude JSON files from the sourcemap?

@hyrious
Copy link

hyrious commented Aug 19, 2024

I guess you can just run a script after esbuild that replaces the json fields in sourcemap with null.

@znewsham
Copy link
Author

This would be tricky - since the filenames aren't retained - or if they are the order is lost - since the code mapping portion of the sourcemap contains hundreds of empty ;; segments.

Seems like a reasonable feature to add though, rather than forcing the use of an onLoad hook that modifies the code (which I have to believe is wildly inefficient) instead make it part of the return of the onResolve hook - excludeFromSourcemap: true (or similar)

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