Fraction.js
Fraction.js copied to clipboard
Rewrite the code to esm?
This is not a request, but a hopefully respectful invitation to a discussion.
I already did it in my fork, and it seems to work for my use case browser TypeScript development without bundling.
I prepend at line 39 export default
in front of the first line of the IIFE, and at line ca. 877... replaced the export machinery with a simple return Fraction
. That's all.
But I am afraid it breaks a lot... Right?
Perhaps a build step to make a cjs version out of the esm version is needed? And browser-legacy and AMD as well?
But I don't know about AMD.
Note: complex.js is also affected.
Hi, thanks for bringing this up! I'm working on this already, but I would like to find a uniform solution that works for all of my modules (Complex.js, Fraction.js, Bitset, ...). Hope you can go along with your fork in the meantime
These are my forks: https://github.com/nalply/fraction and https://github.com/nalply/complex and this is my project using these libraries: https://github.com/nalply/flical.
I took the liberty to vendor the forks with git submodules and also to remove .js
from the project name because I found the extension confusing.
I also researched an EcmaScript and Universal module polyglot just because I was curious if this is technically achievable at all: https://github.com/nalply/modglot, however I didn't apply the trick to fraction and complex, because I am not convinced that modglot is a good idea at all.
Sorry for my fat finger!
The recently released 4.3.6 should meet your requirements.