Skip to content

[Bug]: an empty path key gets added to window.__coverage__ when ModuleFedereationPlugin is used. This causes an error when processing instrumented paths #11513

@jhrinoa

Description

@jhrinoa

System Info

System:
OS: macOS 15.6
CPU: (14) arm64 Apple M4 Pro
Memory: 406.80 MB / 24.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 20.19.4 - ~/.nvm/versions/node/v20.19.4/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.19.4/bin/npm
pnpm: 10.14.0 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 139.0.7258.139
npmPackages:
@rspack/cli: ^1.5.0 => 1.5.0
@rspack/core: ^1.5.0 => 1.5.0
@rspack/plugin-react-refresh: ^1.4.3 => 1.4.3

Details

We recently moved from webpack to rspack and we noticed that Cypress e2e test started failing. This failure was caused by an empty path key that gets added to coverage object.
After hours of investigation, we narrowed it down that using rspack with ModuleFederationPlugin is a key condition for this to happen. So, I created a very simple project for anyone to reproduce the issue.

I added details in the README of this repo.

Reproduce link

https://github.com/jhrinoa/my-rspack-project/tree/main

Reproduce Steps

  1. pnpm install
  2. pnpm cypress intall
  3. pnpm run cypress:run

Note that it runs fine without ModuleFederationPlugin.

  1. Uncomment out ModuleFederationPlugin in rspack.config.mjs
  2. pnpm run cypress:run

Note that it fails.

More detailed instruction on https://github.com/jhrinoa/my-rspack-project/tree/main

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions