Closed
Description
Found from an issue I was diagnosing for @mpodwysocki.
Today, if you use "module": "nodenext"
or "module": "node16"
, you might try to import from a package with ESM files and get the following error message
Module 'yadda/file.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead.
This is extremely confusing. The fix is typically to add the following field to the package.json
that corresponds to the importing file with the error:
"type": "module"