-
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
Support for sourcemap names
#1296
Comments
Cool! I originally hadn't implemented this because I couldn't find a case where it mattered. I'm glad to hear that tooling has finally caught up. In addition to esbuild generating these names itself, it will also have to map names forward from embedded source maps in input files. |
Example CLI program:
Expected output without a sourcemap:
Output with esbuild with symbol mangling and a sourcemap:
Output with rollup+terser with symbol mangling and a sourcemap:
The same output using terser alone with symbol mangling and a sourcemap:
Mangling symbols is not common in bundling NodeJS CLI tools, it was just used to demonstrate the issue more clearly. The actual discrepancies in my case were seeing things renamed like |
Follow up... If the following line in the
then |
Hey @evanw, are there any plans to add support for the source map names in the near future? |
I have implemented support for However, I have not used the feature myself yet as I don't typically use debuggers. Please evaluate esbuild's implementation and let me know if there are any issues. |
I gave this a spin from a branch applying The resulting build is not allowing me to quick outline into the methods so I am not 100% sure if it is working or if something is missing. An example source map with this change is: https://ticino.blob.core.windows.net/sourcemaps/8bd968242f169d3c6a84c19bad1ac78d0b3441c4/core/vs/workbench/workbench.desktop.main.js.map An example VSCode exploration build from this branch is: https://az764295.vo.msecnd.net/exploration/8bd968242f169d3c6a84c19bad1ac78d0b3441c4/VSCode-darwin-universal.zip |
I visualized that source map here and it looks like the names are attached correctly: https://evanw.github.io/source-map-visualization/. |
Hm, I am mainly referring to the resolution in https://bugs.chromium.org/p/chromium/issues/detail?id=1087763#c15 which states we have to update to latest |
Ah. Chrome 102 through 104 has a bug with reading the source maps that esbuild generates: https://bugs.chromium.org/p/chromium/issues/detail?id=1329997. I hear this has been fixed in Chrome 105 which is being released today? According to #2295 (comment). |
@evanw oh wow thanks! I did an experiment with using devtools in the browser for the sources (Chrome 104) and in fact I do see a difference. |
Chrome has some support for renamed identifiers in sourcemaps. Now, VS Code's debugger does too. It looks like esbuild doesn't generate
names
, but if it did it would make debugging easier.The text was updated successfully, but these errors were encountered: