rspack: Build compiles but imports break when using optimization.splitChunks.chunks = 'all' with Module Federation

System Info

System: OS: macOS 13.6.3 CPU: (8) arm64 Apple M1 Pro Memory: 100.59 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.6.0 - ~/Library/Caches/fnm_multishells/85041_1705309080052/bin/node Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/85041_1705309080052/bin/yarn npm: 8.13.2 - ~/Library/Caches/fnm_multishells/85041_1705309080052/bin/npm Browsers: Chrome: 120.0.6099.216 Safari: 17.2.1

Details

Add the following config in a module federation project, and the projects will compile, but the imports break in the actual app.

optimization: { splitChunks: { chunks: 'all' } }

image

As discussed with @ahabhgk and @ScriptedAlchemy, opening this issue to keep track of future solutions

Reproduce link

No response

Reproduce Steps

yarn dev with the config mentioned in any project with Module Federation

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Thanks a lot. This fixes my issue. How can I achieve this with a pure rsbuild config without touching the rspack config override?

@Gillibald would you please try out rsbuild 0.4.0

cc @chenjiahan

I had to explicitly set this to be able to load the remote:

rsbuild

chunkSplit: {
            strategy: 'split-by-module'
        }

otherwise the resulting __webpack_exports__ was undefined