You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular15模块联邦报错:runtimeTemplate.supportsAsyncFunction is not a function

解决Angular 15微前端构建报错:runtimeTemplate.supportsAsyncFunction is not a function

问题原因

你遇到的external "helloworld@http://localhost:3000/remoteEntry.js" - Error: runtimeTemplate.supportsAsyncFunction is not a function错误,本质是webpack版本与Angular 15及配套的@angular-builders/custom-webpack@15.0.0不兼容。Angular 15官方指定的webpack兼容版本范围是~5.69.0,而你使用的webpack@5.94.0版本过高,导致构建工具链内部API调用不匹配。

解决方案

1. 降级webpack到兼容版本

执行以下命令将webpack降级到Angular 15适配的版本:

npm install webpack@~5.69.0 --save-dev

或者直接修改package.json中webpack的版本为"webpack": "~5.69.0",再运行npm install。

2. 同步验证相关依赖兼容性

  • 你当前使用的webpack-cli@4.9.2和webpack-dev-server@4.11.1与webpack@~5.69.0兼容,无需额外调整。
  • 确保宿主和远程微前端应用的webpack版本完全一致,避免模块联邦跨版本冲突。

3. 清理并重新安装依赖

删除现有依赖目录和锁文件,确保依赖安装完全一致:

rm -rf node_modules package-lock.json
npm install

4. 重启开发服务

重新执行npm start启动宿主应用,验证错误是否消失。

内容的提问来源于stack exchange,提问作者Aishwarya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 11:32:33