-
Notifications
You must be signed in to change notification settings - Fork 204
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
"Must use import to load ES Module" problem #79
Comments
Similar issue here. |
Some very strange behaviour going on here. I can replicate this issue on a fresh
Using 12.16.1 fails:
Switching to an earlier version works:
Switching back to 12.16.1 then works:
I have already logged an issue on the esm repository relating to this. Versions prior to 12.16.0 appear to work ok (though 12.14.0 & 12.15.0 thow out an error message). If you are able to upgrade to Node.js v13.2.0+, esm is no longer required (though
|
It appears that ES modules can be loaded using the esm package in Node.js v8.0.0–v12.15.0, and natively in Node.js v13.2.0+. I'm not sure if the gap between those two options will ever get fixed. |
@chrisveness Is there a workaround for this issue? We are currently using it in lambda function and it is breaking with the same error? We are using node version 12.x in lambda function |
@montumodi |
Thanks @jomel. We downgraded it to v1 for this but was wondering if there is any other fix or workaround available. |
Node.js is having a slightly difficult time in migrating from CJS to ESM, I think. This library was originally ES5 for browser only. At some point I added module.export statements for it to work with Node.js. Version 2 was a major enhancement, which was only possible with ES modules (I didn't want to get involved with Babel build steps). In Node.js, CJS & ESM have fundamental differences, which the node team are slowly reconciling. As far as I am aware, current options for using the geodesy library are: |
I get the same error with node
|
Hi, I got the same error message when trying to use V2 on CommonJs modules. Thus, I migrated to using v2 with some code changes as examples below. Basically, in recent Node versions > v12.x, you can use dynamic module loading directly. Note that dynamic ES modules loading works asynchronously.
|
With node 12 , when I tries the sample I got the following error.
It looks like it cannot import the module.
Does it support node 12?
The text was updated successfully, but these errors were encountered: