1

I just upgraded my library from angular 12 to 13 then 14 then 15... was working fine in 14 but it doesn't compile anymore in angular 15.

My TSconfig set target=ES2020 and module=ES2020

I have multiple secondary entry points and dependeces between them, during the build i have the following error on one specific entry points :

------------------------------------------------------------------------------
Building entry point '.../components/form'
------------------------------------------------------------------------------
Compiling with Angular sources in Ivy full compilation mode.
Generating FESM2020
Could not load ...\\dist\\components\\esm2020\\controls\\controls.service.mjs (imported by dist/components/esm2020/form/form/form.component.mjs): Could not load '...dist\\components\\esm2020\\controls\\controls.service.mjs' from memory.

After that temporary files stay in my source code

src      
  components
    controls
      ...
      controls.config.d.ts
      controls.config.d.ts.map
      controls.config.mjs
      controls.config.ts
      controls.service.d.ts
      controls.service.d.ts.map
      controls.service.mjs
      controls.service.ts

I upgradated everything to last version, there is my config

  Angular CLI: 15.2.2
  Node: 18.10.0
  Package Manager: npm 9.5.0
  OS: win32 x64
 
  Angular: 15.2.2

 Package                         Version
 ---------------------------------------------------------
 @angular-devkit/architect       0.1502.2
 @angular-devkit/build-angular   15.2.2
 @angular-devkit/core            15.2.2
 @angular-devkit/schematics      13.3.10
 @schematics/angular             15.2.2
 ng-packagr                      15.2.2
 rxjs                            7.8.0
 typescript                      4.9.5

Before that i was on node 16.x, npm 8.x and typescript 4.8.x but i updated to try to fix my problem.

Doest anybody have the same problem here ? I tried to downgrade multiple version of devkit but nothing worked... idon't have any idea how to fix that.

Interesting thing is that it worked if i set module=CommonJS

Thanks.

I tried multiple version of node/angular 15.x and tried multiple module system

2 Answers2

0

I am having the exact same problem. My Angular library is v16.0.0, My TSconfig set target=ES2020 and module=ES2020, RAM is 16 . I have tried "node --max_old_space_size=8192". I have increased the windows size of the page file https://learn.microsoft.com/en-us/troubleshoot/windows-client/performance/slow-page-file-growth-memory-allocation-errors This did not change anything.

The size of the file I am trying to load is only 5kb. The overall size of the application is not very big. I am getting the same "Could not load ... from memory" message as above. I am starting to wonder if this is not a heap allocation error, but something else.

PabloRiv
  • 11
  • 2
  • Fixed. It turns out that the "Cannot not load...x.mjs from memory" was a misleading error message. The problem was caused by another library (Stencil.js) – PabloRiv Jun 29 '23 at 20:05
  • Do you have any hints on how you found out that it was another library. We've the exact same error message after upgrading to angular 16, node 18.10 in our Azure Pipeline Build (linux based). On our local windows dev environment the build still works with the same setup. – carstinho Jul 31 '23 at 05:33
0

I experienced the issue you described while upgrading to ng16. I just solve it by deleting the .angular folder (+ node_modules and dist) then reinstall and rebuild, no more issues after that.

Florian D
  • 221
  • 1
  • 5