Search code examples
angularice

Using ICE in Angular 10


I'm trying to use zeroC ICE in my Angular 10 application. Just created a simple helloworld Angular app and installed ice with "npm install ice" Then I invoke "Ice.initialise()" but I receive the following error:

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)

Solution

  • I've posted the same question on ICE git.

    Basically you need to:

    • update the project to include the browser version of Ice library.
    • update the build to use a custom webpack configuration, this requires @angular-builders/custom-webpack.
    • In the custom webpack configuration set ice as an external module so that the imports not result in build the node version.

    And here is the detailed solution:

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