-
-
Notifications
You must be signed in to change notification settings - Fork 917
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
node@14.16.0 Error [ERR_REQUIRE_ESM] #471
Comments
Convenient timing, I'm also seeing this issue. |
I have the same problem. |
Here some solutions:
|
I'm having the same issue here... |
Same issue here, very annoying |
I opened a PR opened here to address this issue. You can test it by installing the package from PR's npm npm install github:dankreiger/lowdb#chore/esm-cjs-hybrid-WITH-LIB yarn yarn add github:dankreiger/lowdb#chore/esm-cjs-hybrid-WITH-LIB |
@dankreiger, god bless your soul |
@dankreiger Nice one, thank you! Works like a charm! |
@dankreiger Thank you! Working well :) |
Aces, thanks mate |
same problem |
Closes typicode#462. Closes typicode#471. Implements "main" which is required when your primary export file is not `<root>/index.js`. See https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main
Same problem here. My workaround was rewriting my hole code to esm syntax (I'm glad I did that) and it works in my dev environment, but I have a new problem. I want to use webpack 5 to bundle my express+lowdb app. My bundled Does anyone have a solution for me? Can I reconfigure webpack to build with "import" syntax? webpack.config.js
Edit: |
Closing as I prefer to keep v2 a pure ESM package. I'm aware not every project can migrate to ESM right now, but tools and libraries are catching up. If possible, I'd recommend migrating your project to ESM. For anyone looking to fix the error, please follow this excellent guide: |
I have the same problem with typescript, but I can't use the "type": "module", because it doesn't recognize the ".ts" extension, any solution so far? |
@carlos-burelo Make sure to have ESM modules configured in your tsconfig.json file. It should be on a property called |
@dankreiger thank you :)))) |
@dankreiger thank you soo much!!! @typicode please consider merging the PR that supports cjs. Most off your users have upvoted @dankreiger and down voted your choice to stick with pure ESM. Please consider majority users. |
I trust your judgement, as I am not fully aware of the implications of supporting cjs. If it doesnt create any breaking changes, please consider. Thanks for your work! |
node: 14.16.0
electron: 13.0.1
webpack: 4.46.0
The above code run error,
ERR_REQUIRE_ESM
has been prompted, what is the solution?The text was updated successfully, but these errors were encountered: