Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

differential bundling #280

Closed
Rich-Harris opened this issue Jun 5, 2018 · 5 comments
Closed

differential bundling #280

Rich-Harris opened this issue Jun 5, 2018 · 5 comments

Comments

@Rich-Harris
Copy link
Member

this is a great idea, let's steal it

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

@maxmilton
Copy link

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

@Rich-Harris
Copy link
Member Author

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.

@Conduitry
Copy link
Member

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.

@Rich-Harris
Copy link
Member Author

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

@arxpoetica
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants