Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM not compatible? #200

Closed
yovanoc opened this issue Apr 2, 2022 · 10 comments
Closed

ESM not compatible? #200

yovanoc opened this issue Apr 2, 2022 · 10 comments
Labels
type/bug Something is not working the way it should

Comments

@yovanoc
Copy link

yovanoc commented Apr 2, 2022

Screenshot

image

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

@yovanoc yovanoc added the type/bug Something is not working the way it should label Apr 2, 2022
@andrewicarlson
Copy link
Contributor

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.

@yovanoc
Copy link
Author

yovanoc commented Apr 29, 2022

Ok, you will aim to be ready for the release (24 may) or begin to dev from the that date?

@andrewicarlson
Copy link
Contributor

@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!

@yovanoc
Copy link
Author

yovanoc commented May 25, 2022

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

@yovanoc
Copy link
Author

yovanoc commented Aug 25, 2022

Any news on this? just came back this week ^^

@NTag
Copy link

NTag commented Nov 30, 2022

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 🙏

@fryck
Copy link

fryck commented Dec 8, 2022

I'm stuck too, can we have update on it please ? :| @jasonkuhrt ? Thanks.

@peace-duro
Copy link

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.

Screen Shot 2023-05-11 at 12 22 04 AM

@rostislav-simonik
Copy link
Collaborator

@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.

@rostislav-simonik
Copy link
Collaborator

I did some investigation and summarised it in #693. Currently, I'll be better to remove esm build, because it's not completed. I'll prepare a fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something is not working the way it should
Projects
None yet
Development

No branches or pull requests

6 participants