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.

Possible to blackbox scripts coming from node_modules?

See original GitHub issue

I have long stack traces, I tried skipFiles without much luck. Is there a glob that can be passed in to filter out libraries in node_modules like react etc?

I passed in “node_modules” but that didn’t work (I still get library files in the call stack), I will see if I can make reproducible steps

I tried following the advice of https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_skipping-uninteresting-code-node-chrome which says to use ${workspaceFolder}/node_modules/**/*.js

I was looking for documentation on how to properly do this but couldn’t find any so I opened https://github.com/microsoft/vscode-js-debug/issues/471

Version v2020.5.1217

VSCode Version Version: 1.46.0-insider (system setup)

Screenshot Below you can see on the right I’ve set node_modules in skipFiles. but on the call stack on the left i still have all of the express files.

skipFilesNotWorking

Same but with smartStep enabled image

Steps to reproduce the above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
connor4312commented, Jun 12, 2020

Thanks for the emailed logs!

The problem was because the script skipping logic only used absolute paths for files on disk that were identical to ones Node loaded. Jest does some ‘weird stuff’ in general and this was case for a couple of your files (I actually see the same path getting loaded twice, we ignore the duplicate load but the second one might have been the real file). In f34d43e I changed our logic to use the hypothesized disk path for setting up script skipping, when present, whether or not the contents match. I think this is a better approach since this behavior would have caused the same inconsistencies when using things like ts-node or @babel/register.

cc @roblourens who wrote this code – let me know if you see any problems with this.

If we go this change we can also make skipping initialization synchronous since we no longer do heavy work in this code path.

1reaction
jasonwilliamscommented, Jun 9, 2020

I can’t reproduce this at the moment, so will let you know if i see it again

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to blackbox all scripts from node_modules in chrome's ...
I'm trying to make my stack trace bit cleaner, but adding "/node_modules.js$" to chrome's blackboxing settings is not helping.
Read more >
Journey to the center of node_modules | Frontend Weekly
As frontend developers, we usually treat node_modules as this huge magical black-box where you sacrifice mega or gigabytes of your hard disk ...
Read more >
What's New In DevTools (Chrome 106)
The node_modules and webpack are the third-party scripts. Click on the 3-dot menu and select hide ignore-listed sources to hide them from ......
Read more >
Make Webpack Configuration Easy With wordpress/scripts
It's all a black box, breaks with vague error messages, ... npm install @wordpress/scripts –save-dev ... This is where build comes in. npm...
Read more >
Javascript Debugging With Black Box · Raygun Blog
When we debug, we most likely don't want to debug all those vendor scripts. Most of the time we just want to debug...
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