0

After updating to Angular 18 the node package automapper-ts is no longer working.

When trying to register Automapper in global context, app is undefined, thus the Reference to the Angular App cannot be resolved. Anyone the same prob?

automapper.js

var automapper = (function (app) {
    app.automapper = AutoMapperJs.AutoMapper.getInstance();   <---  ERROR
    return app.automapper;
})(this);
7
  • I wonder how this used to work in the first place. Could be by pure chance. How was this automapper.js file integrated into the Angular app? Commented Jul 8 at 11:24
  • Also, are you using SSR? If not, why don't you save the automapper instance somewhere in the window? Commented Jul 8 at 11:25
  • how would I save the automapper instance in the window? Any resource on this topic you would share? Commented Jul 8 at 12:49
  • You can add custom properties to the window object, see stackoverflow.com/q/12743007/5470544 Commented Jul 8 at 13:07
  • Well, I look for another solution, something critical like app should be working no matter what version is used, maybe something how it is initialized changed, would like to know what and how Commented Jul 8 at 14:44

0