Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

Make Fractal support ES modules #1024

Description

@julkue

What problem would this feature solve?

Currently, it doesn't seem to be possible to use ES modules in the project that is used as the Fractal components library. However, at least repositories from sindresorhus are forcing a migration, see this.

What the feature should look like?

Currently, when the Components Library uses "type": "module" in package.json, the following error will be thrown by Node.js (v14+):

[0] Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: P:\cando-cx-frontend\components-library\build\fractal.js
[0] require() of ES modules is not supported.
[0] require() of P:\cando-cx-frontend\components-library\build\fractal.js from P:\cando-cx-frontend\components-library\node_modules\@frctl\fractal\bin\fractal.js is
 an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
[0] Instead rename P:\cando-cx-frontend\components-library\build\fractal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" fr
om P:\cando-cx-frontend\components-library\package.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions