ajeremiasA
Deno9mo ago
1 reply
ajeremias

build as CommonJS a deno module built for ESM only

Hi, i was trying to import a npm module @fedify/fedify to a nestjs backend and was not sucessful, cause I figured out that fedify is built for ESM only (with deno) and nestjs is built on commonjs.

but i found out this tutorial
https://deno.com/blog/publish-esm-cjs-module-dnt

i run all the commands on fedify, and then tried to import the project in my project and still was a ESM complaining that Error: No "exports" main defined in

so my question is, is there more documentation on how-to exactly build a deno module into commonjs? and how to import it?
Deno Blog
How to write your module with modern tooling and transform it with dnt to support CommonJS, ESM, browsers, Deno, Node.js, TypeScript, and more.
dnt — the easiest way to publish a hybrid npm module for ESM and ...
Was this page helpful?