-
Notifications
You must be signed in to change notification settings - Fork 65
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
Query builder: TypeScript with ESM not working properly #455
Comments
I found this issue while using Nuxt 3's I would be willing to create a reproducible example program, if requested. Edit: Turns out that building with |
edgedb/edgedb-js#455 Essentially @edgedb/generate doesn't care about import file extensions, but Node does.
This issue is becoming more prominent with the advent of Node v20, so I agree we should reconfigure the module work to get compatibility with all of the current LTS versions of Node plus Deno. |
Any idea when this might be addressed? I'm kinda blocked on my project unless I keep editing the import extensions on every code generation which is extremely time consuming. |
Nothing to share as far as timeline is concerned here. Does the |
@scotttrinh I found a workaround for the problem by using For your information, I'm using Nx to manage and build my mono repo, and node + react + graphql + flutter as my frameworks. So nothing too unusual (I think). Oh, its also a refactor from prisma to edgedb. |
I'm using "exports": {
".": "./dist/index.node.js",
"./dist/*": "./dist/*.js"
}, |
I am using Node 16 + ESM + Strictest for my tsconfig.json
Please note that I am not using
NodeNext
for"module"
because some libraries are not supported properly (I am using Fastify).And I also have set
"type": "module"
on package.jsonIn this situation,
--target ts
option does not work with following error:Which is because the import statement does not include
.js
extension in index.tsTo make this work, I have to modify all import statement to include .js extension.
Another workaround is using
--target cjs
and renameindex.mjs
toindex.js
so that it can be properly imported from ts file.The text was updated successfully, but these errors were encountered: