Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Template Cache does not work well with tree shaking, and deferred libraries #1387

Open
TedSander opened this issue Aug 26, 2014 · 2 comments
Milestone

Comments

@TedSander
Copy link
Contributor

Currently the template cache generator will add every html/css resource that is referenced by a component in your application. This has a number of problems:

  • HTML/CSS are loaded on initial load for the whole application. Even if it is only used in a couple of split points. This bloats the initial download when the developer is trying to explicitly remove code from the main application.
  • HTML/CSS for components which may not be used in the application are downloaded in the application. Tree shaking may have eliminated the code for the component, but since the resources are in a map tree shaking could not remove these resources. Many times these resources are actually bigger than code for the component itself. If a developer uses a widget library and doesn't use all of the components he will increase the download size of the application with HTML/CSS that they aren't using.
@TedSander
Copy link
Contributor Author

A possible solution to this is to move away from the Map used to cache HTML/CSS resources and instead inline the HTML/CSS into constants used directly by the components. This will allow the components to still share HTML/CSS when it makes sense, but also allow the compiler to TreeShake the resources.

Thoughts? I have time to work on a solution whatever we agree is the best approach. This would be a transformer moving away from the binary tool we have now.

@mhevery
Copy link
Contributor

mhevery commented Oct 2, 2014

I think we discussed this in person. I think inlineing them into Annotation during transformation is probably the best idea. Postponding for v2.

@naomiblack naomiblack modified the milestones: post v1.0, v1.0 Oct 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants