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

[Question] Why using SystemJS to load async feature areas ? #967

Closed
mildful opened this issue Sep 7, 2016 · 8 comments
Closed

[Question] Why using SystemJS to load async feature areas ? #967

mildful opened this issue Sep 7, 2016 · 8 comments

Comments

@mildful
Copy link

mildful commented Sep 7, 2016

  • I'm submitting a ...
    [ ] bug report
    [ ] feature request
    [x] question about the decisions made in the repository
  • Question:

Since the release of RC5 and NgModule, you are using System.import to load modules asynchronously. I was just wondering why. Since we are using webpack, is it redundant to have SystemJS ?

  • Please tell us about your environment:

Angular version: 2.0.0-rc.5

@paralin
Copy link

paralin commented Sep 8, 2016

I also would like to know this. We were using es6-promise-loader before right?

@luchillo17
Copy link

Maybe because is the recommended way by the Angular 2 staff, however since this repo was already working with es6-promise-loader i do wonder why.

@katallaxie
Copy link
Contributor

katallaxie commented Sep 8, 2016

Do not confuse System.import with SystemJS. System.import is to have dynamic imports and SystemJS is the Polyfill to allow to do this today. System.import is using ES6 promises, so not much different then what es6-promise-loader does. See here

@luchillo17
Copy link

That does make sense, instead of depending on that loader is best to rely on SystemJS to polyfill the System.import that JS is supposed to have in the future, basically getting ready for the future hoping some day we could drop the SystemJS library used to polyfill the import.

@katallaxie Is that right?

@mildful
Copy link
Author

mildful commented Sep 8, 2016

No, I think there are 2 things with the same name : SystemJS.

On one hand, there is the SystemJS that we all know - the module loader - and on the other hand there is the module loader API for ES6, the one we are using here.

I heard about it but I didn't know that they have the same name.

_ I'm not sure but that is what I understand._

@katallaxie
Copy link
Contributor

katallaxie commented Sep 8, 2016

@mildful SystemJS wants to harvest the same mechanism as System.import will do. Dynamically load modules. They provide an API based on Promise, which is polyfilled, that emulates this of System.import. What SystemJS and Webpack do in addition, is to produce these modules. So, the goal of SystemJS is, to have System.import work today, in all browsers, and to have the modules produced.

@luchillo17
Copy link

So it is in deed working as a polyfill in this context.

@PatrickJS
Copy link
Owner

We are using the keywords System.import but it's not related to SystemJS since it's inlined as promises. Webpack 2 gives us this new promise base syntax which allows us to use that rather than our callback style syntax workaround wrapper (es6-promise-loader) require.ensure. Also, note that SystemJS uses the SystemJS global now to be backwards compatible with the future browser loader spec. See guybedford/systemjs-webpack-plugin that will allow SystemJS and Webpack to work together.

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

No branches or pull requests

5 participants