2

Is there a way to put breakpoints and execute the code step-by-step in the code of an npm module which is compiled with webpack?

The compiled code is not that useful for debugging and when the module is imported locally with npm link, only the compiled code is accessed from an application using the module.

How to do this in VSCode (or in any other code editor/ide)?

1 Answer 1

1

you can debug that easily in the browser if you add this row to webpack.config file:

  devtool: "inline-source-map"

and then run the scripts in dev mode:

--mode development

Then, if you set the debugger keyword in your npm package and run that in your main project you will see the full code:

enter image description here

I found another very good article about that topic if you want to learn more https://blog.jakoblind.no/debug-webpack-app-browser/

Sign up to request clarification or add additional context in comments.

1 Comment

thanks devtool: "inline-source-map" works for me !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.