sapper-template icon indicating copy to clipboard operation
sapper-template copied to clipboard

Add a section to README to compare differences &/or considerations for choosing between rollup and webpack.

Open ispyinternet opened this issue 6 years ago • 15 comments

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.

ispyinternet avatar Sep 27 '19 09:09 ispyinternet

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 avatar Nov 30 '19 00:11 pngwn

@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?

Anthropic avatar Apr 25 '20 10:04 Anthropic

Yeah. The rollup version is slightly better (mainly CSS handling) and I would recommend you go with that one.

pngwn avatar Apr 25 '20 10:04 pngwn

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

pushkine avatar Apr 25 '20 22:04 pushkine

@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.

antony avatar May 17 '20 08:05 antony

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.

pngwn avatar May 17 '20 08:05 pngwn

Yep, long term I agree but whilst we have two bundlers, this question does come up a lot.

antony avatar May 17 '20 08:05 antony

Completely agree. Use rollup should be the answer :D

But, yes, we can add a brief overview somewhere.

pngwn avatar May 17 '20 08:05 pngwn

~~@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.

TheComputerM avatar Oct 09 '20 13:10 TheComputerM

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.

pngwn avatar Oct 09 '20 13:10 pngwn

You can achieve the same end result.

pngwn avatar Oct 09 '20 13:10 pngwn

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.

pngwn avatar Oct 09 '20 13:10 pngwn

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.

pngwn avatar Oct 09 '20 13:10 pngwn

There is an FAQ question addressing this: https://sapper.svelte.dev/faq#webpack-vs-rollup

benmccann avatar Oct 09 '20 20:10 benmccann

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.

madeleineostoja avatar Oct 15 '20 22:10 madeleineostoja