-
Notifications
You must be signed in to change notification settings - Fork 432
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
ERR_REQUIRE_ESM #127
Comments
This is weird, I tested on one of my projects with turbo and it worked without any issues. Don't think I used Thanks, gonna check it out. |
I was trying to test the code first before moving on and saw the error. That was why I used |
Same issue here, although it's in the context of firebase cloud functions. Deployment fails with this error:
|
So, the package is built the way that I didn't have any issues on any of my projects/monorepos so far. I don't really want to change module type as mowing towards ESM is the way now. Open for suggestions, maybe I am missing something. Maybe changing (or removing) package "type" could fix the issue, I'll check it out. |
Created a PR #128, could you please try out v3.0.6? Should fix the issue. |
@dmythro
After updating, this error went away. Thanks a lot! |
Great! Glad it's alright now. Please fire an issue if there will be one. I didn't release hybrid ESM/CJS packages before this one, so thanks for reaching out. |
I have
"countries-list": "3.0.5"
installed in my Turbo setup under theconstants
workspace in the packages folder. I don't havetype
specified in mypackages/constants/package.json
.packages/constants/src/index.ts
packages/constants/tsconfig.json
Output:
Attempt 1
Attempt 2
Tried changing a few config based on the article here but no luck https://javascript.plainenglish.io/how-to-correctly-use-typescript-module-import-syntax-and-settings-in-various-circumstances-e98bfa87f70f
Attempt 3 (Worked)
I tried changing "type": "module" to "type": "commonjs" in /xxx/node_modules/.pnpm/[email protected]/node_modules/countries-list/package.json and that worked great for me. But this change will not persist since it's modifying node_modules.
Is there a permanent workaround to properly import your module and run it in TypeScript?
The text was updated successfully, but these errors were encountered: