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

Error when compiling with ESbuild (ESModule) #1664

Open
cjnoname opened this issue Mar 28, 2024 · 7 comments
Open

Error when compiling with ESbuild (ESModule) #1664

cjnoname opened this issue Mar 28, 2024 · 7 comments
Labels
Need More Info 🤷‍♂️ Further information is requested Question ❔ Not future request, proposal or bug issue

Comments

@cjnoname
Copy link

Describe the Bug
Error when compiling with ESbuild (ESModule)

Error details:
"Expected name to be a non-empty string."

We encountered an error while attempting to build the project with ESbuild Typescript (ESModule).

Simply add a basic resolver to the buildSchema function and you'll observe the error. You can reproduce it by following the links below. It's a straightforward setup.

https://eisenbergeffect.medium.com/an-esbuild-setup-for-typescript-3b24852479fe
https://github.com/thomaschaaf/esbuild-plugin-tsc#readme

@MichalLytek
Copy link
Owner

@carlocorradini can you take a look?

@MichalLytek MichalLytek added Question ❔ Not future request, proposal or bug issue Need More Info 🤷‍♂️ Further information is requested labels Mar 28, 2024
@carlocorradini
Copy link
Contributor

carlocorradini commented Mar 28, 2024

I've never used ESBuild... I'm reading this:

IMG_20240328_083211.jpg

Have you tried with force: true ?

@cjnoname
Copy link
Author

cjnoname commented Apr 2, 2024

I've never used ESBuild... I'm reading this:

IMG_20240328_083211.jpg

Have you tried with force: true ?

Hey mate, I tried but doesn't work.

@carlocorradini
Copy link
Contributor

carlocorradini commented Apr 24, 2024

@cjnoname Any update?

@cjnoname
Copy link
Author

cjnoname commented Apr 25, 2024

@cjnoname Any update?

Hey man,

esbuild-plugin-tsc is something that I used at the beginning, but it doesn't work.

We also tried Rollup, but still had no luck and encountered a different error with graphql-yoga.

We have given up because it seems like this package supports TypeScript ESM but doesn't support the compiled TypeScript ESM.

I hope that you guys can take a few minutes to create a TypeScript ESM project with this package and try to compile it with both esbuild and Rollup. Then you'll see the issues.

ESM is the future of NodeJS, and we will wait to move to ESM until your package fully supports it. It would be great if you could add an example of ESM setup that is compilable.

@MichalLytek
Copy link
Owner

I think this is not the package fault. It's the fault of 3rd party compilers that have issues with decorator metadata.
It would end up in the same way if you would use cjs and a 3rd party bundler.

@cjnoname
Copy link
Author

I think this is not the package fault. It's the fault of 3rd party compilers that have issues with decorator metadata. It would end up in the same way if you would use cjs and a 3rd party bundler.

I don't agree, bro. We've been using webpack for 7 years with CJS without any issues, same as Rollup. If the package uses the old CJS way to import the package or employs the ES5 method of exporting a module, then it won't compile correctly on ESM.

ESBuild might not support decorators properly, but Rollup does support them in a great way, yet it also gets stuck on the graphql-yoga package.

Additionally, I tried both and found that the typegraphql package seems to be the only one that could not be compiled across all the packages I am using. Both compilers throw errors and stop at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Need More Info 🤷‍♂️ Further information is requested Question ❔ Not future request, proposal or bug issue
Projects
None yet
Development

No branches or pull requests

3 participants