Skip to content

remoteEntry.json points to non-hashed JS files in dev mode while Vite serves hashed chunks → host fails with 404 #947

@sushil-waykar

Description

@sushil-waykar

With what library do you have an issue?

native-federation

Reproduction of the bug/regression with instructions

Description
When using Angular 18 CLI with @angular-architects/native-federation, I noticed a mismatch between the filenames listed in remoteEntry.json and what Vite actually serves in dev mode (ng serve).

In ng serve (dev):

remoteEntry.json contains entries like:

{
"./ProductsModule": "ProductsModule.js"
}

But the Vite dev server only serves hashed chunks from memory, e.g. ProductsModule-XYZ.js.

Result: the host requests ProductsModule.js → 404.

If I manually request the hashed filename (ProductsModule-XYZ.js), it returns valid JS.

In ng build (prod):


remoteEntry.json points to ProductsModule.js.

Vite outputs ProductsModule.js in dist/....

Everything works as expected.

Steps to Reproduce

Create a host + remote with ng g @angular-architects/native-federation:init.

Expose a module in the remote (ProductsModule).

Run the remote using ng serve products --port 4201.

Check dist/ → no files written (expected for dev).

Host tries to load http://localhost:4201/ProductsModule.js → 404.

But http://localhost:4201/ProductsModule-XYZ.js responds with the actual module code.

Expected behavior

In dev mode, either:

remoteEntry.json should list the hashed chunk name that Vite generates (ProductsModule-XYZ.js), OR

Provide an option to disable hashing in dev so that ProductsModule.js is consistent across dev and prod.

Versions of Native/Module Federation, Angular, Node, Browser, and operating system

Angular CLI: 18.2.0

@angular-architects/native-federation: [18.2.7]

Node.js: [20.19.2]

OS: [Windows]

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions