nexus-prisma
nexus-prisma copied to clipboard
ESM not compatible?
Screenshot

Description
I build my ts files with esbuild src/**/*.ts --platform=node --minify --target=esnext --format=esm --outdir=dist
and here's my yarn test
command: cross-env NODE_ENV=${NODE_ENV:-development} DOTENV_FLOW_PATH=../.. node -r dotenv-flow/config ./dist/index.js
We should aim to add official ESM support upon the release of TypeScript 4.7.
Some work has been done to provide incremental ESM support using libraries like typescript-esm
but there have been test regressions as a result. Once official ESM support lands in TypeScript we'll look to implement a solution accordingly.
Ok, you will aim to be ready for the release (24 may) or begin to dev from the that date?
@yovanoc I believe we should add the official ESM support after it's released in TypeScript but can't provide a date by which it'll be merged. If you'd like to take a stab at implementing it based on the beta I think it'd spark great discussion!
Its now released (https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/)
I can't do this in the next weeks so if someone want to tackle this
Any news on this? just came back this week ^^
I'm sad the commit has been reverted, it's annoying as it prevents to use vitest for example which is ESM-first.
Would be very appreciated that nexus-prisma supports ESM properly as the whole ecosystem is now moving to it 🙏
I'm stuck too, can we have update on it please ? :| @jasonkuhrt ? Thanks.
The transpiled esm files have .js
extensions instead of .mjs
. This breaks builds because .js
is process as CJS while .mjs
is processed as ESM. The output files should name them with the .mjs
suffix.
@peace-duro there was an attempt here https://github.com/graphql-nexus/nexus-prisma/pull/192/files but then it was reverted to support other prisma versions, but it was time where we were supporting 3.x.x. Currently we are already on 4.x.x.
Do you want to try to reintroduce given PR to see what happens to tests.
I did some investigation and summarised it in https://github.com/graphql-nexus/nexus-prisma/discussions/693. Currently, I'll be better to remove esm build, because it's not completed. I'll prepare a fix for that.