You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Can you create a minimal repo that shows this issue? Not sure I can understand what is going on here otherwise.
We currently still support Node 10 (will drop once some other work is completed), so can't move to ESM ourselves just yet but there should be some level of cross-compatibility I believe.
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+):The text was updated successfully, but these errors were encountered: