Skip to content

[Bug]: 'Panic occurred at runtime' with 1.7.2 in Module Federation context #12693

@tetelb

Description

@tetelb

Version

System:
    OS: macOS 26.2
    CPU: (11) arm64 Apple M3 Pro
    Memory: 105.50 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 143.0.7499.147
    Firefox: 85.0
    Safari: 26.2
  npmPackages:
    @module-federation/rsbuild-plugin: 0.21.6
    @rsbuild/core: 1.7.2
    @rsbuild/plugin-react: 1.4.2
    @rsbuild/plugin-sass: 1.4.0

Details

A 'Panic occurred at runtime' error occurs when building a federated module using @rsbuild/[email protected]. Version 1.7.1 works fine.

Reproduce link

https://github.com/tetelb/rspack-repro

Reproduce Steps

// rsbuild.config.ts
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin'
import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'

export default defineConfig({
  plugins: [
    pluginReact(),
    pluginModuleFederation({
      name: 'remote',
      manifest: true,
      exposes: {
        '.': './src/entry.ts',
        './path': './src/entry.ts' // <-- same file
      },
    }),
  ],
  server: { cors: { origin: ['http://localhost:5173'] } },
})
// src/entry.ts
import('./bootstrap')
// src/bootstrap.tsx
import { createRoot } from 'react-dom/client'

const rootElement = document.getElementById('root')

const App = () => 'Hello World'

if (rootElement) {
  const root = createRoot(rootElement)

  root.render(<App />)
}
> rsbuild build

Rsbuild v1.7.2

info    build started...
Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues: panicked at crates/rspack_core/src/lib.rs:341:26:
Chunk(ChunkUkey(Ukey(2), PhantomData<rspack_core::chunk::Chunk>)) not found in ChunkByUkey
[1]    98448 abort      npm run build

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