Webpack日志输出问题

时间:2019-06-19 23:12:33

标签: node.js webpack

我有一个基于webpack的{​​{1}}项目。当我启动它(node.js)时,它进入了npm run start函数(openBrowser),并且它的内部显然无法编译应用程序。日志输出仅为react-dev-utils,没有其他内容,因此我需要一种显示堆栈跟踪的方法。这是failed to compile脚本代码中与此处相关的部分:

start.js

我怀疑可以为const devServer = new WebpackDevServer(compiler, serverConfig); // Launch WebpackDevServer. devServer.listen(port, HOST, err => { if (err) { return console.log(err); } if (isInteractive) { clearConsole(); } console.log(chalk.cyan('Starting the development server...\n')); openBrowser(urls.localUrlForBrowser); }); 添加一些参数来实现这一点。不确定webpack.config.json消息只是被webpack掩盖了,但是在这种情况下,可能需要对其进行修改。任何建议将不胜感激。

  

更新

我能够通过更改react-dev-utils配置的clientLogLevel参数来改善日志输出。仍然不够详细,无法找出问题所在。这是一个webpackDevServer项目,模块无法编译,但是没有相关的输出说明为什么发生这种情况。我检查了Redux文件中的devtool属性,并将其设置为webpack.config.js,根据线程,它似乎是正确的:

How to find the file where my React/Redux error is coming from?

我还向我的eval添加了以下内容:

plugins

我在这里找到的地方:https://github.com/webpack/webpack/issues/708

不走运,堆栈跟踪没有用,没有向我显示语法/其他错误的位置。

  

更新

最终,该项目的设置linter过于严格,并且由于较小的格式问题而无法编译:使用tab而不是两个空格等。由于我使用的是function(){ this.plugin("done", function(stats){ if (stats.compilation.errors && stats.compilation.errors.length) { console.log(stats.compilation.errors); process.exit(1); } }) } ,因此我需要为vim中的javascriptjsx文件:

Setting Vim whitespace preferences by filetype

我很困惑,因为我认为简单的格式变化不应完全使编译失败。日志输出实际上显示格式问题。仍要知道.vimrc中的哪些设置会导致这种行为。

0 个答案:

没有答案