Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

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

Open
ispyinternet opened this issue Sep 27, 2019 · 15 comments

Comments

@ispyinternet
Copy link

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.

@pngwn pngwn added the docs label Nov 30, 2019
@pngwn
Copy link
Member

pngwn commented Nov 30, 2019

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.

@Anthropic
Copy link

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

@pngwn
Copy link
Member

pngwn commented Apr 25, 2020

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

@pushkine
Copy link

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

@antony
Copy link
Member

antony commented May 17, 2020

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

@pngwn
Copy link
Member

pngwn commented May 17, 2020

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.

@antony
Copy link
Member

antony commented May 17, 2020

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

@pngwn
Copy link
Member

pngwn commented May 17, 2020

Completely agree. Use rollup should be the answer :D

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

@TheComputerM
Copy link

TheComputerM commented Oct 9, 2020

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

@pngwn
Copy link
Member

pngwn commented Oct 9, 2020

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
Copy link
Member

pngwn commented Oct 9, 2020

You can achieve the same end result.

@pngwn
Copy link
Member

pngwn commented Oct 9, 2020

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
Copy link
Member

pngwn commented Oct 9, 2020

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.

@benmccann
Copy link
Member

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

@madeleineostoja
Copy link

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.

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

No branches or pull requests

8 participants