-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add importsExtension to the config #599
Conversation
Nice, thank you! |
Thanks for responding to the PR so quickly. The source files would use the Since I'm still learning when to use The Kanel project appears to be using ESM import statements (import / export) rather than CommonJS imports (require / module.exports). So I would say that using either the The While developing (before compilation to JavaScript), it appears that TypeScript is smart enough to associate a reference with an extensionless and To make the setting a little clearer, it could be renamed to something like I'm open to hearing any suggestions and thoughts you might have. |
Right, maybe the extension should be configurable, then? It seems like the kind of thing that might come up. Otherwise, if you can make the linter and tests happy, I will merge and publish this! |
I took your advice and renamed The property is an empty string by default and will generate imports the same as before if set to this. The possible extensions are The extension will only be applied for project file references (any import path containing a External package imports will not use the configured extension, if set. I also added some docs and regenerated them. |
Very nice! Just one question: the example config has the extension set to empty string, but the generated models seem to have |
That was my bad. I was testing with the extensions and forgot to rerun the example. |
This is now published. |
Added a boolean configuration parameter named
esmImports
.If set to true, a
.js
extension will be added to imports.If set to false, no extension will be added. (this is the current behavior)
I was using this NPM package to solve my problem:
https://www.npmjs.com/package/fix-esm-import-path
Having the logic integrated into Kanel is more developer friendly for me.