-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
TypeScript compilation error for CommonJS modules #175
Comments
Sorry to hear that the update broke CommonJS compatibility, I was already afraid that would be the case. Indeed I think Rimbu should be compatible, so I'll keep this on high priority. I think the main culprit is using the import/export maps internally. CommonJS has no clue how to resolve these references. In effect, I should get rid of the import maps, but export maps should still be fine. I'm currently working on a new Rimbu package that will have a simpler structure. After publishing I'll see if I can copy that structure to all the other packages, but it will be quite a bit of work. Thanks for bringing up the issue! |
Thank you for prioritizing this issue! In the meantime, I've been facing quite a 🌊tsunami of compilation errors while trying to convert my new libraries to ESM... especially when combined with TypeScript, it still feels like an extremely experimental and fragile standard (I had serious issues with Jest + SWC, and now even with vitest, if I try to transpile my tests!) As for Rimbu when referenced by a CommonJS project, this line seems to provide a very interesting clue:
I also agree a lot on the idea of simplifying - maybe even flattening - the directory structure within each package, because it was probably one of the main obstacles I had to deal with when extending Rimbu, whereas the code by itself was very elegant, symmetrical and clear. I hope my hints might prove helpful! Thank you and keep up the good work! |
The fix has now also been released. I hope it fixes the issue, but let me know if you still run into problems. |
Both projects now compile! 🥳 Thanks a lot! Keep up the 🌟excellent work! |
Even though the test suites in my projects referencing Rimbu (especially Hermes and OmniCourse-core) were not affected by the changes introduced by Rimbu 1.0 and its new ESM-based packaging, alas it seems that TypeScript compilation is failing, as described by this GitHub Actions log.
As a matter of fact, this event led me to start exploring code migration to ESM and vitest as well - and I must admit that the latter seems brilliant indeed - but not all users might want to move to the new standard (actually, I'm facing a few issues myself - for example, I can't compile vitest-based tests, as described in this still open issue).
In the arcane world of TypeScript transpilation, I wasn't actually able to find a flag (provided it actually exists) to fix the issue caused by the new version of Rimbu - but I suspect it might be due to the fact that the library only provides ESM-compatible TypeScript declaration files, having .d.mts extension, in lieu of the classic .d.ts files with their related statements.
Needless to add that, after moving Hermes to ESM, the project compiles perfectly, and its tests run fine under vitest as well.
The text was updated successfully, but these errors were encountered: