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.

Sourcemap problems (bad sourcecode references) after running npm audit --fix

See original GitHub issue

🐛 bug report

I’m not sure how to categorize this bug, but the result of it is that debugging source-code in developer tools (I only tried Chrome) becomes difficult or impossible, presumably due to incorrect sourcemap references. For example, If I set a break point via debugger or in developer tools, it will break and enter the debugger but on the wrong line in the source code, and then when stepping through the code it jumps around to different lines and source files, seemingly at random.

It seems to have come from doing an npm audit --fix. I normally specify next for Parcel version in my package.json but npm complains that there are a lot of security vulnerabilities and suggests I perform an npm audit --fix. So I did that. I am not sure what changes were made except that the version of Parcel in my package.json was updated from next to 2.0.0-nightly.524, and debugging in Chrome developer tools becomes difficult because the lines of code being pointed to are wrong, for example when attempting to set a break point or step through the source code. I presume this is a problem with the sourcemaps. I was able to get it working again by changing the Parcel version back to next in package.json, wiping my node_modules folder and re-npm install-ing, but then npm complains about 46 vulnerabilities again.

🎛 Configuration (.babelrc, package.json, cli command)

I dont have a .babelrc, only package.json.

in package.json,

{
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "documentation": "^13.1.0",
    "eslint": "^7.17.0",
    "eslint-config-prettier": "^6.15.0",
    "parcel": "next",
    "parcel-plugin-nuke-dist": "^1.0.1",
    "prettier": "^2.2.1"
  },
}

Parcel next version comes out to 2.0.0-beta.1 for most Parcel related things in package-lock.json.

🤔 Expected Behavior

Opening developer tools using Parcel’s provided sourcemaps should allow a developer to set breakpoints in the code and pause at the correct line of the source code.

😯 Current Behavior

Breakpoints seem to be observed but happen on the wrong lines and in the wrong files.

💁 Possible Solution

Ignore npm’s complaints about vulnerabilities and do not perform the suggested npm audit --fix

👉 Yes, I did donate some money! Thanks!!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
devongovettcommented, Jan 13, 2021

I think #5638 should fix the issue with comments.

image

Btw, @evanw your source map visualizer is incredibly good. Thanks for making it! 😄

0reactions
ebrensicommented, Jan 13, 2021

Thanks a lot! I just woke up to see all of this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Npm install gives warnings, npm audit fix not working
The best thing I recently learn was install the npm-check-updates. It does everything automatically. run ncu for list in my case was this:...
Read more >
Changelog - Cypress Documentation
Before this change, a spec was scaffolded with either the wrong spec name or the incorrect component import which led to invalid JS...
Read more >
source-map - npm
A SourceMapConsumer instance represents a parsed source map which we can query for information about the original file positions by giving it a ......
Read more >
How I solved and debugged my Webpack issue through trial ...
So I tried to set up the source maps as described in the docs by adding devtool. When webpack bundles your source code,...
Read more >
Firebase JavaScript SDK Release Notes - Google
Fixed issue where clients using Node.js v18 would use the native Blob object, ... Fixed proactive refresh logic in Authentication when Realtime Database, ......
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