mathjs: ES5 support is broken for Angular users (MathJS 6+)
I have just upgraded my Angular project to use MathJS 6.0.3 so I could use tree-shaking and reduce my bundle size. The first test was ok, everything good on chrome, bundle is 1.5MB smaller (amazing work, BTW, thank you very much for that), but the app started failing on IE11.
Since I was running the production build, the first error I could extract was this one:
The (selected) arrow function was crashing IE.
After that, I tried to reproduce the problem with dev build and the error moved to a different place:
Again, IE crashes on the =>
.
I confess I was a little bit lost with this issue, I could swear angular-cli
would take care of the transpilation of libraries, but it seems that it doesn’t. So, it looks like MathJS 6+ is now the first library that I’m using that is breaking ES5 compatibility, and since the download page states that Math.js works on any ES5 compatible JavaScript engine, I’m raising this issue.
Is this by design and MathJS 6 requires ES2015+ engines? I believe we should either change the documentation or fix these compatibility issues.
Please, let me know if you need any help.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (5 by maintainers)
I’d love to help more, but I’m afraid I don’t have that much knowledge on how to create a library with ES6 and ES5 support in parallel, and also how Angular CLI bootstraps Webpack (I don’t even know if what I say makes sense in this regard haha), so I probably won’t be able to help much more for now 😦 I’ll try to have a look again once I have more free time to revisit it.