-
Notifications
You must be signed in to change notification settings - Fork 0
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
Port to ESM #48
Port to ESM #48
Conversation
would we still be able to consume this in the api2 repo then? |
If you are able to consume ESM dependencies in the |
Only via |
I think that's a shortcoming of the |
Whoops, wrong button |
yes, but it's a pita to enforce ESM on the backend. the ecosystem isn't there yet. currently only Sindre does it and we're pinning all his modules to old versions because of it 🤷 How about? https://github.com/isaacs/tshy |
Well, since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry man, as it stands the backend ecosystem isn't as far progressed with ESM adoption as the frontend and hence moving to it now without CJS exports would limit the utility of this repo's contents.
I also see this PR brings improvements that are not ESM-port related, those are non-controversial and can be merged imho.
Note that Node.js is doing work to relax around ESM, after which i expect this all to go down much smoother.
But forcing ESM upon backend repos before that is just causing extra work and headaches, that will all be solved for us if we can just not do it for another dozen of months or so.
Can you elaborate on 'the ecosystem is not ready'? As far as I understand it, it is perfectly possible to import CJS modules from ESM code since Node.js 12 (14?), and so, the ecosystem shouldn't matter as much, barring packages with badly defined entry points. So what causes the relaxed/improved parsing of module types (eg. not dependent on file extension) to improve that situation for us? As the consumer of modules, we will need to do a migration to either |
The ecosystem extends beyond just Node.js; it encompasses various other factors such as the readiness of certain tools like Sucrase, along with our usage of outdated versions of Mocha, Jest, dynamically requiring files, etc. The transitioning phase will require some time and is not as simple as setting Jumping the gun (imho) by porting the api repo to ESM today, would entail a considerable amount of extra work with minimal customer value to show for it. This work might become superfluous if we choose to wait for a few more months. For instance, it's not unlikely that post our upgrade to Node 22, we'll be in a position to import ESM modules even if the api2 repo remains unported because of the aforementioned issues. In short I feel this approach may provide a more pragmatic path forward, ensuring we navigate through this transitional phase with efficacy and efficiency. |
Superseded by #49 |
After the earlier changes made today and yesterday, this was a relatively small effort.
This PR also enables
strict
andnoUncheckedIndexedAccess
in the roottsconfig