Skip to content

[Bug]: Module Federation breaks publicPath / assetsPrefix #3751

@danantal

Description

@danantal

Version

System:
OS: Windows 11 10.0.22631
CPU: (32) x64 AMD Ryzen 9 3950X 16-Core Processor
Memory: 28.51 GB / 63.92 GB
Browsers:
Edge: Chromium (128.0.2739.42)
Internet Explorer: 11.0.22621.3527
npmPackages:
@rsbuild/core: 1.0.15 => 1.0.15
@rsbuild/plugin-react: 1.0.5 => 1.0.5

Details

Adding an empty module federation configuration to a basic RSBuild app breaks the publicPath / assetsPrefix by removing the leading slash.

moduleFederation: {
  options: {
    name: 'app',
  }
}

With moduleFederation:
Image

Without moduleFederation:
Image

Reproduce link

https://github.com/danantal/rsbuild-demo

Reproduce Steps

  1. Run pnpm i
  2. Run pnpm dev
  3. Navigate to localhost:3000/foo/

Expected: page loads correctly
Actual: blank page due to assets referenced incorrectly

If you comment out the moduleFederation configuration in rsbuild.config.ts then it works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions