-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ES5 support is broken for Angular users (MathJS 6+) #1565
Comments
This could possibly be related to #1558. I'm not very familiar with the issue myself but I expect a fix is in the works. |
Eric, I don't see how those problems could be related (the bug seems to be related to a few methods while this one happens with a single arrow function), but I don't know much about babel as well, so you might have a point. |
Yeah sorry @brunojcm this is an upstream issue with Babel and we are waiting for a fix from them. We should indeed support ie 11 |
Thanks @harrysarson! Could you please refer to the upstream issue, if you have it handy, so I can follow it? |
Well, this is the same issue mentioned in the PR Eric posted here, so I still don't get how an issue related to the |
We test maths on ie 11 in our ci and this issue came up when the newest version of Babel was published. I have no idea exactly what Possibly the error you are seeing in your browser has been translated by source maps? |
No luck with the PR. Tried enabling arrow function plugin, no luck as well. Something looks very wrong here. I can't find any npm script to pass |
One thing worth mentioning is that I'm importing like
which seems to follow |
@brunojcm the This may be similar to #1554 |
That's indeed very similar!
No, and AFAICS angular CLI does not transpile libs. I don't even know where to start, and based on angular/angular-cli#9126 it doesn't seem something easy to maintain. I still have to study a lot more about all these JS tools/packagers, but what seems wrong to me is to copy all |
Some new findings here, it seems that importing from I use MathJS in two points here, one in the main app, which goes into the vendor chunk, and the other one in a lazy loaded angular module, which goes into the (let's call) lz1 chunk. main: Here are the numbers I get replacing
These numbers don't make much sense for me, but that's what I got here. Hopefully that will help you figure out what's going one. For now, I'll stick with importing from |
If you use I've just done a test to double check whether the exported modules and treeshaking works correctly. I created an empty React application using
When building the application, it runs just fine on IE11 and other browsers, and treeshaking works as expected (only thing was I had to add a polyfill for So it looks like you'll have to dig into your webpack setup further, or just use the es5 version. |
I'm not sure about the differences between Angular and React, but I tried the same with both React and Angular, and for Angular and it failed again on IE 11, it's not something specific to my app. This is the Angular project I tested with (target set to es5):
Again, I'm far from being an expert, but comments on this issue does not encourage that at all. At least for Angular CLI users changing Babel/Webpack directly is very hard, if possible.
Not an option anymore... I just found out that importing from |
Thanks for sharing you project, I will try to do some debugging soon. Having to do complicated babel/webpack setups in angular projects shouldn't be needed, it should just work for Angular projects as it does for React. Haven't used Angular in years myself though, any help would be very welcome. |
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. |
Probable cause: #1554 (comment) |
This issue should be fixed now in |
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.
The text was updated successfully, but these errors were encountered: