dgp1130 / rules_prerender

A Bazel rule set for prerending HTML pages.
13 stars 0 forks source link

Lazy loading #35

Open dgp1130 opened 3 years ago

dgp1130 commented 3 years ago

Need to investigate the lazy loading story. My hope is that we can rely on users leveraging dynamic import() at a known URL. If we can update Rollup to chunk a particular file to an independent module as ESM, this could just work out of the box. It's unknown how much work this is for Rollup to create a manual common chunk like this and how much boilerplate will be necessary to make it happen. Ideally such a path would be included in a web_resources() rule and even check via strict deps in a rules_prerender TS plugin. The MVP for this probably won't go that far.

We should also investigate how plausible it is to support tree shaking for symbols inside the common chunk. Rollup should have all the knowledge necessary to make that happen, but I'm not familiar enough with Rollup configuration to know how hard that is.

We should also investigate lazy loading for custom bundled pages and how we can make that easier. I'm not sure there's a whole lot to do here, but we should at least see what it is like and what problems users would run into here.