question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sourcemaps and runtime variables misaligned, yielding difficult debugging

See original GitHub issue

Can 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.

screen shot 2017-02-14 at 10 33 46 am

^ Notice how parseUrl is defined and valid, yet I cannot access it in the render scope.

screen shot 2017-02-14 at 10 33 57 am

^ 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:

  1. npm ls react-scripts (if you haven’t ejected): 0.9.x
  2. node -v: 7.4.1
  3. npm -v: 4.12.1, yarn 0.19.1

Then, specify:

  1. Operating system: el cap
  2. Browser and version: chrome 56.0.2

Reproducible Demo

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
wasifhydercommented, May 15, 2017

I’m able to get the variable bindings aligned by using the following .babelrc file.

// .babelrc
{
  "presets": [
    "react",
    ["es2015", {"modules": false}]
  ],
  "plugins": [
    ["transform-es2015-modules-commonjs-simple", {
      "noMangle": true
    }]
  ],
  "sourceMaps": true
}
0reactions
gaearoncommented, Jan 8, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found