简体   繁体   English

登录到节点控制台或在Webpack构建期间进行调试

[英]Log to node console or debug during webpack build

What is the best practice for debugging during webpack build process? 在webpack构建过程中进行调试的最佳实践是什么? Any console.log in the entry script doesnt output to node console. 输入脚本中的任何console.log都不会输出到节点控制台。

As of the current version of webpack (September 2019), if you do a build instead of launch a dev server, console.log will output to std out (ie the node console). 从当前版本的webpack(2019年9月)开始,如果您执行构建而不是启动开发服务器,console.log将输出到std out(即节点控制台)。

Just make sure you are doing a full build (ie "npm run build") instead of a dev server (ie "npm run dev"). 只要确保您正在执行完整构建(即“ npm run build”)而不是开发服务器(即“ npm run dev”)即可。

The dev server disables console.logs during the compile process in many circumstances, and/or the way the progress bar updates, the console.log strings are overwritten so you never see them. 在许多情况下,开发服务器会在编译过程中禁用console.logs,并且/或者在进度条更新的方式中,console.log字符串会被覆盖,因此您永远看不到它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM