Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Main chunk points to the wrong runtime chunk when using Module Federation #19439

Copy link
Copy link
Closed
@gtempesta-pixartprinting

Description

Bug report

What is the current behavior?

When running the watch command, at some point the runtime-app chunk referenced in the app chunk is different from the one referenced in the asset-manifest.json.

Since we load this code in a PHP app, we use the manifest to load the chunks dynamically.

Having the manifest reference a different chunk than the one referenced in the app chunk means that the browser loads two different runtime-app chunks, one requested by the manifest, and the other by the app chunk.

Since the second one is the oldest, the end result is that the watch command is not doing its job, because from a certain moment, I'm not able to see the changes I make to the code reflected in the browser.

If the current behavior is a bug, please provide the steps to reproduce.

Here is a GitHub repository with the code needed to reproduce the issue: https://github.com/gtempesta/webpack-issue-repro/.

How to reproduce:

  1. Clone the repository
  2. Run npm install to install the dependencies
  3. Run npm run watch to start watching for changes
  4. Open the asset-manifest.json file in the public folder, and open the app chunk that is referenced in the entry-points field. Now look for the runtime-app chunk in the app chunk and check that it's the same that is referenced in the asset-manifest.json file: it should be the same (with the same hash)
  5. Make a change to the code in app.js and save it
  6. The issue is still not there
  7. Now make a change to the design-area.js file and save it
  8. The issue should be there now: the runtime-app chunk in the asset-manifest.json file and in the app chunk should have different hashes

The issue happens only when using the watch command, and not when using the build command (which is not implemented in this repo).

What is the expected behavior?

I would expect that the runtime-app chunk referenced in the asset-manifest.json file and in the app chunk are always the same, so that I can use the manifest to load the chunks dynamically without having to worry about which one is loaded.

Other relevant information:
webpack version: 5.99.5
Node.js version: 18.17.1
Operating System: macOS Sequoia 15.3.2
Additional tools:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.