You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to work with ESM (ES Module) only libraries like node-fetch #269
I'm submitting a ...
[ ] bug report
[ x ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
Currently, if you add a dependency like node-fetch, it breaks the build/run/test because module is set to commonjs. There is a non trivial amount of configuration to actually reconfigure the project for ESM.
First you have to setup the project to build esm, which is easy enough because node-fetch gives you the steps:
as mentioned here though (Update TypeScript recipe for ESM support avajs/ava#2593 (comment)), by default ava will still be looking for files with the .js extension, which isn't what you get from tsc. To finally have the tests pass again, you need to enable --experimental-specifier-resolution=node in the ava config:
Activity