Open ispyinternet opened 5 years ago
There are actually pretty significant differences between the two and we probably need to consider whether or not we want to continue supporting both bundlers in the future as sapper apps created with webpack are not the same as the rollup version.
You're right, this should be documented.
@pngwn as someone starting to look into Sapper & Svelte I'd love to know which one the team behind it would recommend at the least, would I be correct to assume given Rollup was also from Mr Harris that it is the better supported choice to get started on?
Yeah. The rollup version is slightly better (mainly CSS handling) and I would recommend you go with that one.
I've had issues with rollup bundling several instances of the same store, massive headaches right there and webpack even has hot reloading, tbh I don't know why it's not the default @rixo did a fantastic job on it, check it out here https://github.com/rixo/sapper-template-hot#webpack
@pngwn does this feel like a FAQ to you or a docs/readme thing?
I'm considering FAQ right now with a pointer in the docs near the degit
stuff.
I think the docs could mention there are different versions, any comparison should probably live elsewhere. The FAQ could be a decent place for it.
Ultimately I’d like us to support a single bundler and remove support for webpack but I don’t know how others feel about this. The only reason there is a webpack version is for historic reasons (when Sapper was first created, rollup didn’t do codesplitting).
The work that @rixo is doing on the tooling side will resolve any dev tooling complaints peoples have about rollup and the output is superior.
Yep, long term I agree but whilst we have two bundlers, this question does come up a lot.
Completely agree. Use rollup should be the answer :D
But, yes, we can add a brief overview somewhere.
@pngwn It would be better if there is support for both bundlers as webpack has many benefits over rollup. I have worked with both bundlers and generally agree with what Rich Harris has written: Use webpack for apps, and Rollup for libraries. Webpack also provides better code splitting and support for dynamic imports.
For example you cannot do this in rollup.
Turns out the problem was with sapper and not rollup, had to place dynamic imports inside onMount, sorry for the confusion.
That article is outdated and Rich no longer holds those views. Rollup also supports dynamic imports and has equal code splitting support for javascript modules.
You can achieve the same end result.
This isn't the right place for support questions and is a rollup rather than svelte question.
There are a variety of plugins that can help in addition to other solutions. The rollup gitter is probably the best place to ask.
And I'm saying there is a workaround (several in fact), you can achieve broadly the same result. While it doesn't emulate the webpack API (thankfully), you can still get the same outcome.
This, however, is not the correct forum for rollup support.
There is an FAQ question addressing this: https://sapper.svelte.dev/faq#webpack-vs-rollup
FWIW I'd probably abandon Sapper if it dropped Webpack support. While Rollup is a fantastic bundler for JS/etc libraries, every time I've tried to use it for large scale web projects I've found the support just isn't there for handling more complex asset pipelines. Something as simple as loading font imports from CSS files was a major headache with Rollup, and a one-liner in Webpack.
The standard advice in the wider dev community that I've seen is "Rollup for libraries, Webpack for apps", and I wholeheartedly agree with that. If anything I'd love to see Sapper standardize on Webpack.
There is a small mention of hot module loading - but not even sure if that is still working? however, any notable considerations between bundle size / browser support / ease of use. Even if the statement were to say - there are no differences.