Skip to content

[@module-federation/rsbuild-plugin] Invalid ESM entrypoint #4433

@JohnDaly

Description

@JohnDaly

Describe the bug

The ESM entrypoint for @module-federation/rsbuild-plugin imports a .json file without an accompanying import attribute, which causes Node.js to crash with the following error:

node:internal/modules/esm/assert:88
        throw new ERR_IMPORT_ATTRIBUTE_MISSING(url, 'type', validType);
              ^

TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///.../node_modules/@module-federation/rsbuild-plugin/package.json" needs an import attribute of "type: json"
    at validateAttributes (node:internal/modules/esm/assert:88:15)
    at defaultLoad (node:internal/modules/esm/load:132:3)
    at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:483:32) {
  code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}

I believe this was likely introduced by #4351

Reproduction

Attempt to execute a module with contents: import '@module-federation/rsbuild-plugin'; on a modern version of Node.js

Used Package Manager

npm

System Info

Node.js v22.12.0

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