-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: esm support #66
base: master
Are you sure you want to change the base?
Conversation
Hi @H01001000 Thanks for your contribution I also added some missing conditions to add the ".js" or "index.js"
Its already part of the project. I've added to CI checks now. I was unable to run the example that you have created, its working for you? I also don't quite understand the advantage of this approach (esm) as opposed to the approach that the old example already used. Could you help me clarify this so I can add it to the readme? |
@Cauen can try to use ts-node --esm? not really are there advantage esm vs cjs (you can read more googling), but if for example if some deps are in esm (e.g. node-fetch) you must use esm instead cjs, otherwise you can't import them node throw error |
Not working but... I think the ideal would be for the "inputs-simple-sqlite-esm" example not to work without the new "esm" support configuration. Exactly as was your case, right?
I'm just confused because I've always used ESM in my projects and I've never had the limitation of inserting ".js" extensions in imports |
@Cauen cuz it works for me Are you sure you putting "type": module in package.json, and tsconfig compile to es module, without those you are still using commonjs, cuz from what i look tsconfig you use will compile esm to cjs |
@H01001000 I'm referring to the example you created in the project |
For that I mean your other project |
As it currently stands, does it work for you? |
@Cauen see if this work, i suspect the only diff my env and your is im install using yarn |
@H01001000 I'm using Yarn too, even with 4.0 from your change its not working Same error:
|
@Cauen could you use |
🚀 But the example project runs even without the need to use this new functionality I believe you use the build process and use node without ts-node, right? |
This PR makes generated files use module imports (with .js ext and refactor import directory to import directory/index), making the generated file be used in an esm environment
close #63
p.s. suggest add eslint or prettier