Sapper: differential bundling

Created on 5 Jun 2018  Â·  5Comments  Â·  Source: sveltejs/sapper

this is a great idea, let's steal it

https://twitter.com/benjamn/status/1003735863921082370

Most helpful comment

Said this in the forum:

FWIW, I find it confusing to tag --legacy on a build -- makes it seem like it's only doing something old

All 5 comments

That sounds amazing! Would probably be fun implementing in https://github.com/sveltejs/sapper-template eventually too.

This is implemented in 0.18.7. Currently it only works for Rollup apps — here's a template: https://github.com/sveltejs/sapper-template-rollup/tree/babel (it might make sense for that to be the master branch, haven't decided).

Documentation to come (https://github.com/sveltejs/sapper.svelte.technology/issues/30) but it's pretty simple — vary the client build config based on process.env.SAPPER_LEGACY_BUILD and use the --legacy flag, and Sapper takes it from there. It will use the modern build for apps that support async functions, and the legacy build for everything else.

Might it even make sense to have the webpack and rollup templates in the same repo on different branches? I'm assuming there are quite a few files that are identical among all versions (webpack/rollup and regular/legacy). We could master be just purely the app and assets and a readme, and put all the actual build stuff in different branches on top of that. Then we just tell people to npx degit sveltejs/sapper-template#rollup-legacy or whatever.

Probably, yeah... in fact you can even have webpack and rollup in the same project, and do sapper build --bundler webpack or sapper build --bundler rollup if you're the kind of person who struggles with commitment. Though separate branches in the same repo is probably the right approach

Said this in the forum:

FWIW, I find it confusing to tag --legacy on a build -- makes it seem like it's only doing something old

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rich-Harris picture Rich-Harris  Â·  3Comments

Rich-Harris picture Rich-Harris  Â·  4Comments

benmccann picture benmccann  Â·  3Comments

nolanlawson picture nolanlawson  Â·  4Comments

milosdjakovic picture milosdjakovic  Â·  3Comments