sourcemaps and runtime variables misaligned, yielding difficult debugging
See original GitHub issueCan you reproduce the problem with latest npm?
yes
Can you still reproduce it?
yes
Description
The sourcemaps appear to work, however, the browser runtime (chrome, in my case) does not honor variable names.
^ Notice how parseUrl
is defined and valid, yet I cannot access it in the render scope.
^ in fact, _url.parse
is a thing. i don’t understand why url
was mangled to _url
or why a new var parseUrl
was not put into scope.
I realize that this might be a browser issue, vs a create-react-app issue, but can’t say for certain because it may related to CRA’s source-map generation.
Expected behavior
Have vars accessible in scope as written in source
Actual behavior
vars are mangled and hidden from the user.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): 0.9.xnode -v
: 7.4.1npm -v
: 4.12.1, yarn 0.19.1
Then, specify:
- Operating system: el cap
- Browser and version: chrome 56.0.2
Reproducible Demo
- clone https://github.com/cdaringe/react-scripts-source-map-wonky-isms
- cd <project>
- yarn
- yarn start
- open dev tools. it should already break at the correct location to see the failure mode
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
4 Reasons Why Your Source Maps are Broken - Sentry Blog
Here are four reasons why your source maps are broken and tips on how ... Debugging Minified JavaScript with Source Maps, before continuing....
Read more >Source Maps are an Insufficient Debugging Format for the Web
Source maps — the sole debugging format for compilers targeting JavaScript — can reconstruct source-level location information (filename, ...
Read more >VSCode not parsing inline sourcemaps properly when ...
I ended up editing the debugging configuration and I got it to work, somehow. Here's the configurations. The project structure is as follows...
Read more >Source maps in Node.js. Supporting the many flavors of…
These differences make debugging difficult — the stack trace displayed in the code being run doesn't match the code being written.
Read more >How to Use Source Maps in TypeScript Lambda Functions ...
Smaller bundles can make deployments faster and may even help with cold start and execution time. However, this can make debugging difficult ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m able to get the variable bindings aligned by using the following .babelrc file.
Closing this as stale. If this is still a problem I encourage you to figure out which project is responsible for this issue (either Babel or Webpack) and follow up with them.