Skip to content

[bridge-react] Incorrect exports config for /plugin - require points to ES module #4268

@aki2421997

Description

@aki2421997

Describe the bug

Describe the bug

The exports configuration in @module-federation/bridge-react/package.json has an error for the /plugin export. The require field incorrectly points to the ES module file instead of the CommonJS file.

Current behavior (incorrect)

"./plugin": {
"types": "./dist/plugin.d.ts",
"import": "./dist/plugin.es.js",
"require": "./dist/plugin.es.js" // ← Points to ES module!
}### Expected behavior

"./plugin": {
"types": "./dist/plugin.d.ts",
"import": "./dist/plugin.es.js",
"require": "./dist/plugin.cjs.js" // ← Should point to CJS file
}### Impact

This causes SyntaxError: Unexpected token 'export' when using Jest or any CommonJS environment that tries to require('@module-federation/bridge-react/plugin').

The CJS file dist/plugin.cjs.js exists and is correct, but the exports config doesn't reference it.

Version

  • @module-federation/bridge-react: 0.14.3

Reproduction

  1. Install @module-federation/bridge-react
  2. Run Jest tests that import from /plugin
  3. Error: SyntaxError: Unexpected token 'export'

Reproduction

ew

Used Package Manager

yarn

System Info

System:
    OS: macOS 15.7.2
    CPU: (12) arm64 Apple M3 Pro
    Memory: 88.06 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    Yarn: 4.2.2 - ~/.nvm/versions/node/v22.14.0/bin/yarn
    npm: 11.5.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
  Browsers:
    Chrome: 143.0.7499.147
    Edge: 143.0.3650.80
    Safari: 18.6

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