为什么我的管道在运行webpack时突然超时



我的azure管道yaml:中有这一步

- task: webpack@4
displayName: webpack
inputs:
webpackCliArguments: '--config webpack.$(buildConfiguration).config.js'
workingFolder: $(projects.workingFolders.webApi)

它一直运行良好,通常这一步骤在大约8分钟左右的内完成

最近,我在webpack.config.js中添加了这些[contenthash]更改,以防止用户在部署更改后不得不硬刷新:

const devMode = process.env.NODE_ENV === 'development';    plugins: [
new CleanWebpackPlugin(pathsToClean, cleanOptions),
new MiniCssExtractPlugin({
filename: devMode ? "[name].bundle.css" : "[name].[contenthash].bundle.css"
})
],
output: {
.... ....
filename: devMode ? "[name].bundle.js" : "[name].[contenthash].bundle.js" 
},

现在,管道将突然挂在webpack步骤上,一个小时后超时,取消整个运行这种情况间歇性发生,似乎平均每2次运行就会发生

##[error]操作已取消。

我没有证据表明我的更改是造成这种情况的原因,但时间非常巧合。

有人知道在webpack输出的文件名中使用[contenthash]是否会导致这样的挂起吗?或者,有人知道我如何调试这个问题吗?

例如,我如何让webpack将任何问题记录到azure管道窗口?console.log似乎不起作用。


设置system.debug=true后,我现在可以在日志中看到以下消息

executing the command: node --inspect "E:BuildsRemoteAgent1_work613sProjectnode_moduleswebpackbinwebpack.js" --json --config webpack.Release.config.js --display verbose
##[debug]Re-evaluate condition on job cancellation for step: 'webpack'.
##[error]The operation was canceled.
##[debug]System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)

我们仍然不确定这里的问题是什么,但通过从webpack配置module.rules:中删除thread-lodaer来解决它

...
{
test: /.(sa|sc|c)ss$/,
use: [MiniCssExtractPlugin.loader,
'thread-loader',                                         // remove this line
{ loader: 'css-loader', options: { sourceMap: false } },
{ loader: 'sass-loader', options: { sourceMap: false } }
]
},
...

到目前为止,它似乎没有引起任何问题

相关内容

  • 没有找到相关文章

最新更新