How to debug the file "webpack.config.js"?

I want to debug the file "webpack.config.js" and not an application using "devtool: 'source-map'". I want the webpack configuration file to be debugged. Is there any option?

+4
source share
1 answer

Just run webpack.jsin debug mode using nodejs. You can run the following on your terminal (if you are already in the directory with your node_modules present):

node --inspect node_modules/webpack/bin/webpack.js --colors

I also found that the VSCode debugger is very intuitive to debug when I was developing my own webpack loader. If you are using VS Code, you can have the launch.jsonfollowing configuration:

{
        "type": "node", 
        "request": "attach",
        "name": "Attach",
        "port": 5858
}

node :

node --inspect-brk=5858 node_modules/webpack/bin/webpack.js --colors

, , , .

+3

Source: https://habr.com/ru/post/1665327/


All Articles