Skip to content

How does System.import() work? #275

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

Closed
pksjce opened this issue Oct 25, 2016 · 3 comments
Closed

How does System.import() work? #275

pksjce opened this issue Oct 25, 2016 · 3 comments

Comments

@pksjce
Copy link

pksjce commented Oct 25, 2016

Premise
System.import() allows webpack to define split points for code splitting using es6 modules. It is a replacement for require.ensure()

Findings

  • Multiple dependencies cannot be imported using System.import() alone. We need to Promise.all[System.import(), System.import()]. But as per System.load support? webpack#3141, that does not work as expected as well.
  • Named chunks are not possible using System.import(). require.ensure() has a parameter that allows us to name the chunks, hence separating or combining code from other split points in the application. This does not seem to be available with System.import()

Ask
System.import() does not seem to be a perfect replacement and seems to create more problems. Are there workarounds for these issues?

@SpaceK33z
Copy link
Member

The workaround is to create a new module that contains the modules you want to lazy load.

@skipjack
Copy link
Collaborator

Maybe this can be merged with the discussion in #589? (or at least tackled in the same PR)

@pksjce
Copy link
Author

pksjce commented Feb 1, 2017

Sure!

@pksjce pksjce closed this as completed Feb 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants