简体   繁体   English

在 azure devops 中创建构建管道时反应应用程序 webpack5 配置出现问题

[英]Issue with react app webpack5 configuration when creating build pipelines in azure devops

Below is my build command,下面是我的构建命令,

 "build": "webpack --mode=production --config webpack.prod.js",

Below is my webpack related packages,下面是我的 webpack 相关包,

"webpack": "^5.11.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.7.3"

Below is webpack.prod.js,下面是 webpack.prod.js,

const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'production',
});

In local build command is working fine but Getting below error in pipelines,在本地构建命令工作正常,但在管道中出现以下错误,

[webpack-cli] TypeError: The 'compilation' argument must be an instance of Compilation
at Function.getCompilationHooks (....\Web\ClientApp\node_modules\webpack\lib\NormalModule.js:171:10)
at ...\Web\ClientApp\node_modules\webpack\lib\HotModuleReplacementPlugin.js:705:18

在此处输入图像描述

Usually, local build environment is different from Microsoft-hosted agents , so if your project build result depends on build environment, you'd better deploy self-hosted agents , which will run on your local environment.通常,本地构建环境与Microsoft 托管的代理不同,因此如果您的项目构建结果取决于构建环境,您最好部署自托管代理,它将在您的本地环境中运行。

If you still want to use Microsoft-hosted agents , you can see the installed software for each hosted agent by choosing the Included Software link in the table.如果您仍想使用Microsoft 托管的代理,您可以通过选择表中的包含软件链接来查看每个托管代理的已安装软件。 在此处输入图像描述 And then compare it with local build environment, to decide to install other required software/libraries/packages or specific software version to build your project.然后将其与本地构建环境进行比较,以决定安装其他所需的软件/库/包或特定软件版本来构建您的项目。

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

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