Skip to content

@module-federation/enhanced fails to resolve runtimePlugins package names #4953

Description

@dmchoi77

Describe the bug

The @module-federation/enhanced documentation states that runtimePlugins supports package names.

However, with @module-federation/enhanced@2.8.1, using a package name as a runtimePlugins entry fails during the build. The package name is converted into a filesystem path relative to process.cwd() instead of being resolved using Node.js module resolution.

Configuration that fails:

runtimePlugins: [
  '@module-federation/inject-external-runtime-core-plugin',
],

Actual result:

Module not found: Error: Can't resolve
'<project-root>/@module-federation/inject-external-runtime-core-plugin'

The build succeeds when the package is passed through require.resolve():

runtimePlugins: [
  require.resolve('@module-federation/inject-external-runtime-core-plugin'),
],

A package name supplied to runtimePlugins should be resolved using Node.js package resolution and behave the same as the absolute path returned by require.resolve().

Reproduction

https://github.com/dmchoi77/enhanced-runtime-plugins-repro

Used Package Manager

pnpm

System Info

OS: macOS
Node.js: v22.22.0
pnpm: 10.28.0
Package: @module-federation/runtime-core@2.8.1

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions