Using ICE in Angular 10



我正在尝试在Angular 10应用程序中使用zeroCICE。刚刚创建了一个简单的helloworld Angular应用程序,并安装了带有";npm install ice";然后我调用";Ice.initialize((";但我收到以下错误:

ModuleRegistry.js:25 Uncaught TypeError: m.require is not a function
at ModuleRegistry.js:25
at Array.forEach (<anonymous>)
at Function.require (ModuleRegistry.js:23)
at Object.<anonymous> (Ice.js:7)
at Object../node_modules/ice/src/Ice/Ice.js (Ice.js:45)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/ice/src/index.js (index.js:5)
at __webpack_require__ (bootstrap:79)
at Module../src/app/app.component.ts (main.js:109)
at __webpack_require__ (bootstrap:79)

我在ICE git上发布了同样的问题。

基本上你需要:

  • 更新项目以包含Ice库的浏览器版本
  • 更新构建以使用自定义webpack配置,这需要@angular builders/custom webpack
  • 在自定义webpack配置中,将ice设置为外部模块,以便导入不会导致生成节点版本

下面是详细的解决方案:

https://github.com/zeroc-ice/ice/issues/1039

最新更新