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?
packages
compiler, fluurt runtime, and bundler plugins
Description
The basic idea is this:
<if>
)import()
that loads the conditional chunk<link rel="prefetch">
tags for the conditional chunk<link rel="preload">
to give higher priority to chunks we know are already neededWhy
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: