-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add --nosources option for source maps #624
Comments
Thanks for the detail. Doing this makes sense. Injecting the original source code is by far the heaviest part of the source map, and is only useful in some scenarios. I think |
This will be fixed in the next release. Closing. |
wow, awesome, I just ran into exactly this (aws lambda with esbuild via aws-lambda-nodejs), and so happy to found that you added an option for it. Thanks for your work! |
Context
I am using esbuild to bundle and minify Typescript functions for AWS lambda.
esbuild --bundle --minify --keep-names --sourcemap --platform=node --target=node12
To get meaningful stack traces for exceptions in production, I use the
--sourcemap
and--keep-names
options.I use
NODE_OPTIONS=--enable-source-maps
to get a stack trace that uses the source map.One problem is, that I have to use the
--keep-names
option to see the original function names in the stack trace.I guess that it could be related to the missing
names
field in the generated source map, but I'm not an expert on this topic.Issue
The
--sourcemap
option adds the original source to thesourcesContent
field of the source map. This is not necessary for meaningful stack traces, it can be an empty array"sourcesContent": []
.Adding the complete source to the source map thwarts the goal of making the AWS Lamda artifact small
as it doubles the size of the zip package (index.js + index.js.map) I need to upload to AWS Lambda.
I would like an esbuild option
--nosources
that prevent sources from being included in the source map.Something similiar to the webpack devtool option
nosources-source-map
My current workaround is to post process the generated source map from esbuild and remove the sourcesContent.
The text was updated successfully, but these errors were encountered: