Next.js Discord

Discord Forum

Breakpointing node_modules

Answered
Slate-throated Redstart posted this in #help-forum
Open in Discord
Slate-throated RedstartOP
I am using the pages router and am experiencing an odd bug when working with a node package. I was hoping to breakpoint the js in the node_module, but it seems that the webstorm debugger cannot attach to node_modules when run in NextJS. Upon inspecting .next, it seems that's because all node_module code is stringified and read using eval. I then attempted to use config.devtool = "source-map", but I got a warning when running the dev server saying

Warning: Reverting webpack devtool to 'eval-source-map'.
Changing the webpack devtool in development mode will cause severe performance regressions.
Read more: https://nextjs.org/docs/messages/improper-devtool


Is there a way to set breakpoints in node_modules, and if so what steps are needed to do so?
Answered by Slate-throated Redstart
Figured it out. Have to go into the JS Debug Run Config tab (while running) -> Scripts -> webpack://_N_E/node_modules/{route to package js} and breakpoint there
View full answer

1 Reply

Slate-throated RedstartOP
Figured it out. Have to go into the JS Debug Run Config tab (while running) -> Scripts -> webpack://_N_E/node_modules/{route to package js} and breakpoint there
Answer