Skip to content
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

requirejs broken by corejs upgrade #26

Closed
jods4 opened this issue Jan 6, 2016 · 1 comment
Closed

requirejs broken by corejs upgrade #26

jods4 opened this issue Jan 6, 2016 · 1 comment
Assignees
Labels

Comments

@jods4
Copy link
Contributor

jods4 commented Jan 6, 2016

This line of code inside createLoader() is now an issue for us, since the last corejs update (2.0.2):

if (window.System) {

The whole story is a bit complicated and I'm not 100% sure what the fix should be...

We use requirejs as our AMD loader. This means that we shouldn't have window.System defined.

What triggered the issue is that corejs now contains a polyfill for System.global.
But by creating the System object, it fooled Aurelia into thinking that I have a System loader, which I don't. So the code crashes on the next line with System.normalizeSync is undefined.

Now, you might think "well, let's be more specific and test if (System && System.normalizeSync)". I think this would fix the short-term crash but I'm not sure if it's a long-term solution.

Consider this: in the future, what will happen when users finally upgrade to a modern browser that includes a built-in System loader?

Answer: Aurelia will think that I'm using the System loader... and nothing will work because I deploy optimized requirejs bundles.

I think it would be best if either:

  • Aurelia tests for the presence of requirejs first: if (window.require) else if (window.System). Since there is no reason requirejs would be loaded unless I'm intending to use it; or
  • Aurelia takes some explicit config at startup that says which loader I am using, no guessing game.

This is a critical issue: without dirty work-arounds using Aurelia + latest corejs + requirejs simply does not work.

@EisenbergEffect EisenbergEffect self-assigned this Jan 6, 2016
@EisenbergEffect
Copy link
Contributor

Good news is that I was planning to make some improvements in there this week. So, I can address this then too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants