The main fix here is removing "type": "module" from package.json 😞. Prettier loads in CJS mode no matter what, so trying to import .js files with ESM imports causes the require() complaints.
I couldn't figure out a clean way to get ESBuild/tsup to switch .js extensions in source files to switch to .cjs/.mjs in outputs. Which is probably for the best, that'd be spooky...
Two followups:
Hardens against default/namespace import confusion in a couple of places that started complaining
Corrected package.json's "exports" to reflect that there are now two emit modes
PR Checklist
status: accepting prs
Overview
The main fix here is removing
"type": "module"
frompackage.json
😞. Prettier loads in CJS mode no matter what, so trying to import.js
files with ESM imports causes therequire()
complaints.I couldn't figure out a clean way to get ESBuild/tsup to switch
.js
extensions in source files to switch to.cjs
/.mjs
in outputs. Which is probably for the best, that'd be spooky...Two followups:
package.json
's"exports"
to reflect that there are now two emit modes💖