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

Add lazy loading for vendor file #4

Open
B-Stefan opened this issue Jan 15, 2016 · 2 comments
Open

Add lazy loading for vendor file #4

B-Stefan opened this issue Jan 15, 2016 · 2 comments

Comments

@B-Stefan
Copy link
Collaborator

The support for split the vendor file in separate files is more complex then the application.
I think the only way to do this is to modify the loader so that the loader itself support lazy loading.

The reason for the is that we don't can control the dependencies between the vendor modules. Currently, for manual setting up the bundles for the vendor file you need to know about the internal structure of the vendor dependencies.

@MiguelMadero
Copy link

This works OOB in Ember today, see

ember-cli/rfcs#28

I have not tested it to see if it really satisfy our requirements, but it seems like the right approach. It's implemented and available on cli 2.4.2

@MiguelMadero
Copy link

I tested this earlier today and it works great for vendor files (e.g. bower_components or vendor/), but it doesn't do addons yet. All addons still end up in vendor.js. I'm planning to extend the current API to add support for the outputFile for an addon, something like: app.import('addon/ember-power-select/', {outputFile: vendor-core.js}).

It isn't as simple since all of the dependencies of ember-power-select will still end up in the default vendor.js file, so we need to make sure we don't break anything by loading vendor-core first and delaying vendor.js. The trick would be to make the default the "first" non-lazy loaded and manually specify a different output file for things we know that can be lazy loaded. Unfortunately, this creates a lot of coupling since now we need to know about the dependencies of our dependency. For example, if I add ember-power-select today I don't worry about ember-wormhole and truth-helpers, things simply work. In the future, ideally we can be more explicit about "groups" of dependencies, but for now, being aware of indirect dependencies sounds like an acceptable trade-off for cases where lazy-loading is important.

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

2 participants