Skip to content

ssr+i18n throw In-memory ESM relative file should always exist #32713

@wszgrcy

Description

@wszgrcy

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

If i18n, SSR, and assets request are configured, the following error occurs.

config

{
          "builder": "@angular/build:application",
          "options": {
            "localize": [
              "en"
            ],
            "browser": "src/main.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "public"
              }
            ],
            "styles": [
              "src/styles.css"
            ],
            "server": "src/main.server.ts",
            "outputMode": "server",
            "security": {
              "allowedHosts": []
            },
            "ssr": {
              "entry": "src/server.ts"
            }
          }

and request any assets

 data = resource({
    loader: async (input) => {
      return firstValueFrom(this.#http.get(`test.text`, { responseType: 'text' }));
    },
  });

build log as follow

\➜  ssr1 git:(master) ✗npm run build
Debugger listening on ws://127.0.0.1:62952/ba55e689-9694-4a67-a90c-4fa2f7ca3f78
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
npm warn Unknown user config "msvs_version". This will stop working in the next major version of npm.

> ssr1@0.0.0 build
> ng build        

Debugger listening on ws://127.0.0.1:62954/259aa559-5bf5-40e1-8f32-6ccece67e40d
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

uncaughtException AssertionError [ERR_ASSERTION]: In-memory ESM relative file should always exist: 'file:///C:/code/my-project/ssr1/.angular/prerender-root/34778af1-d6e3-4e7e-85f6-68a2c814c5b3/angular-app-engine-manifest.mjs' --> './en/main.server.mjs'
    at resolve (C:\code\my-project\ssr1\node_modules\@angular\build\src\utils\server-rendering\esm-in-memory-loader\loader-hooks.js:80:31)       
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:201:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:845:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
    at MessagePort.callbackTrampoline (node:internal/async_hooks:130:17) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: undefined,
  operator: 'fail',
  diff: 'simple'
}
Browser bundles
Initial chunk files   | Names            |  Raw size | Estimated transfer size
main-EQM76B7T.js      | main             | 249.94 kB |                68.45 kB
polyfills-7FR7WZWP.js | polyfills        | 136 bytes |               136 bytes
styles-5INURTSO.css   | styles           |   0 bytes |                 0 bytes

                      | Initial total    | 250.07 kB |                68.59 kB


Server bundles
Initial chunk files   | Names            |  Raw size
server.mjs            | server           | 810.29 kB |
main.server.mjs       | main.server      | 684.96 kB |
polyfills.server.mjs  | polyfills.server | 233.39 kB |
chunk-WVQMRNL5.mjs    | -                |   1.39 kB |
chunk-VB3FBMFV.mjs    | -                |   1.05 kB |

Lazy chunk files      | Names            |  Raw size
chunk-HPMYPLCO.mjs    | xhr2             |  12.22 kB |
chunk-OUZZXTQV.mjs    | xhr2             |  12.15 kB |

Prerendered 1 static route.
Application bundle generation failed. [38.307 seconds] - 2026-03-06T08:40:11.923Z

✘ [ERROR] An error occurred while prerendering route '/aa/en/test1'.

Request for: http://localhost:62982/aa/en/test1 was aborted.
TimeoutError: The operation was aborted due to timeout

Minimal Reproduction

clone https://github.com/wszgrcy/ssr-issue
npm i
npm run build

Exception or Error


Your Environment

Angular CLI       : 21.2.0
Angular           : 21.2.1
Node.js           : 24.10.0
Package Manager   : npm 11.6.1
Operating System  : win32 x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.2.0            │ ^21.2.0           │
│ @angular/cli              │ 21.2.0            │ ^21.2.0           │
│ @angular/common           │ 21.2.1            │ ^21.2.0           │
│ @angular/compiler         │ 21.2.1            │ ^21.2.0           │
│ @angular/compiler-cli     │ 21.2.1            │ ^21.2.0           │
│ @angular/core             │ 21.2.1            │ ^21.2.0           │
│ @angular/forms            │ 21.2.1            │ ^21.2.0           │
│ @angular/localize         │ 21.2.1            │ ^21.2.1           │
│ @angular/platform-browser │ 21.2.1            │ ^21.2.0           │
│ @angular/platform-server  │ 21.2.1            │ ^21.2.0           │
│ @angular/router           │ 21.2.1            │ ^21.2.0           │
│ @angular/ssr              │ 21.2.0            │ ^21.2.0           │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 5.9.3             │ ~5.9.2            │
│ vitest                    │ 4.0.18            │ ^4.0.8            │

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions