Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Use with an ESM project #14

Open
NickPadilla opened this issue Aug 25, 2024 · 0 comments
Open

Cannot Use with an ESM project #14

NickPadilla opened this issue Aug 25, 2024 · 0 comments

Comments

@NickPadilla
Copy link

I was playing around with this project, see if could get some docs built out for some open source. However, I could not get it to run as I am getting this error:

npx code-narrator
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/box/structures/structures-js/structures-api/code-narrator.config.js from /Users/box/.npm/_npx/e378fa2a901701d1/node_modules/code-narrator/dist/src/utils/CliHelper.js not supported.
Instead change the require of code-narrator.config.js in /Users/box/.npm/_npx/e378fa2a901701d1/node_modules/code-narrator/dist/src/utils/CliHelper.js to a dynamic import() which is available in all CommonJS modules.
    at /Users/box/.npm/_npx/e378fa2a901701d1/node_modules/code-narrator/dist/src/utils/CliHelper.js:73:96
    at async CliHelper.getConfig (/Users/box/.npm/_npx/e378fa2a901701d1/node_modules/code-narrator/dist/src/utils/CliHelper.js:73:30)
    at async /Users/box/.npm/_npx/e378fa2a901701d1/node_modules/code-narrator/dist/src/cli.js:12:22 {
  code: 'ERR_REQUIRE_ESM'
}

This is the folder within the open source I am trying to test this against. https://github.com/Kinotic-Foundation/structures/tree/main/structures-js/structures-api

I did need to modify the code-narrator.config.js to use import statements and not use require to get past the first error.

I believe using vite might be a better build tool, as it should allow building for both CommonJS and ESM. If I find the time, I might play around with this and see if can get it to work.. just don't have the time right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant