sachinraja / trpc-playground

playground for running tRPC queries in the browser
MIT License
281 stars 19 forks source link

Unable to import ERR_REQUIRE_ESM #36

Closed ansh closed 1 year ago

ansh commented 1 year ago
Error [ERR_REQUIRE_ESM]: require() of ES Module /Developer/backend/node_modules/@trpc-playground/html/dist/index.js from /Developer/backend/node_modules/trpc-playground/dist/handlers/express.cjs not supported.
Instead change the require of index.js in /Developer/backend/node_modules/trpc-playground/dist/handlers/express.cjs to a dynamic import() which is available in all CommonJS modules.

Not sure what this error message means. Some Googling suggest I change "module" and "target" in tsconfig.json but them moment I make them esnext, all of my other package imports (including trpc) break!

NodeJS v16.18.1 TypeScript 4.9.3 "trpc-playground": "^1.0.0", "@trpc/server": "^10.5.0",

And my tsconfig was just created by running tsc --init

sachinraja commented 1 year ago

fixed in 1.0.1, thanks for reporting!

ansh commented 1 year ago

beast mode!

On Wed, Dec 21 2022 at 09:31, Sachin Raja < @.*** > wrote:

fixed in 1.0.1

— Reply to this email directly, view it on GitHub ( https://github.com/sachinraja/trpc-playground/issues/36#issuecomment-1360826161 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AB6T25IZCHKOYP47QYE6ZQLWOJ6KVANCNFSM6AAAAAATEIGIRI ). You are receiving this because you authored the thread. Message ID: <sachinraja/trpc-playground/issues/36/1360826161 @ github. com>