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

Automatic code splitting + preloading/prefetching #28

Open
mlrawlings opened this issue Nov 19, 2019 · 1 comment
Open

Automatic code splitting + preloading/prefetching #28

mlrawlings opened this issue Nov 19, 2019 · 1 comment

Comments

@mlrawlings
Copy link
Member

packages

compiler, fluurt runtime, and bundler plugins

Description

The basic idea is this:

  • Determine which parts of the tree are rendered conditionally (under a parent <if>)
  • Determine the bundle size impact of this conditionally rendered content
  • If the size is over a certain threshold:
    • compile to a dynamic import() that loads the conditional chunk
    • generate <link rel="prefetch"> tags for the conditional chunk
    • when server rendering conditional content, inject a <link rel="preload"> to give higher priority to chunks we know are already needed

Why

To make applications fast by default

Possible Implementation & Open Questions

This will likely require some back-and-forth between the bundler and the compiler (with coordination between client and server compilations, much like the @marko/webpack plugin does now). Specifically to answer these questions:

  • How do we determine the bundle size impact of a conditional chunk?
  • How do we get the public url of the generated chunks?
@tigt
Copy link
Contributor

tigt commented Dec 29, 2019

Just chiming in to say apparently <link rel=modulepreload> is a thing now

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