-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Export husky module in project defaulting to ESM requires the .default() property usage #1362
Comments
Why not do By the way, docs have been updated recently regarding this. It's not using an |
The issue remains the very same, however the import is done. And husky is not installed at deployment on the cloud or CI, a full conditional control over its import is mandatory. And whatever is the use case, a default ESM import of a function shall just work. The root cause is that the exports fields miss types et import fields. And since husky seems to be ESM only now, properly unsupport commonjs. |
Thank you I forgot the reason for the await. I'll have a look. |
I think node.js has CLI arguments to enforce ESM module resolution to cook a unit test. |
I've done some quick search and I think it's normal to have to use
|
Fair enough. I guess it's then just a matter of updating the documentation and/or the release notes. |
To reproduce:
husky
in aprepare.js
ESM module and try to run it in the prepare step:import('husky').then(husky => husky())
:TypeError: husky is not a function
at file:///Users/I339261/SAPDevelop/e-mobility-charging-stations-simulator-git/prepare.js:7:33
import('husky').then(husky => husky.default())
worksUsing the default attribute on
husky
imported ESM module is not expected.The text was updated successfully, but these errors were encountered: