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
When attempting to use clientlibs-cli inside of a project with a package.json that contains "type": "module", I receive this error:
Error [ERR_REQUIRE_ESM]: require() of ES Module /../mysite/ui.frontend/clientlib.config.js from /../.local/share/pnpm/global/5/.pnpm/aem-clientlib-generator@1.8.0/node_modules/aem-clientlib-generator/bin/clientlib-cli.js not supported.
Instead change the require of clientlib.config.js in /../.local/share/pnpm/global/5/.pnpm/aem-clientlib-generator@1.8.0/node_modules/aem-clientlib-generator/bin/clientlib-cli.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/../.local/share/pnpm/global/5/.pnpm/aem-clientlib-generator@1.8.0/node_modules/aem-clientlib-generator/bin/clientlib-cli.js:44:21) {
code: 'ERR_REQUIRE_ESM'
}
node:internal/errors:841
const err = new Error(message);
Is there a way to add support for ES Modules?
The text was updated successfully, but these errors were encountered:
Just in case someone googles the error message and comes to this page, this is my solution:
Rename clientlib.config.js to clientlib.config.cjs
In the "scripts" section of package.json, explicitly provide the new config file name. e.g.
"prod": "npm run build && clientlib clientlib.config.cjs --verbose",
When attempting to use clientlibs-cli inside of a project with a package.json that contains "type": "module", I receive this error:
Is there a way to add support for ES Modules?
The text was updated successfully, but these errors were encountered: