rollup / rollup-watch

Fast incremental rebuilds with Rollup CLI
MIT License
91 stars 23 forks source link

Increasing bundle size on incremental builds #46

Closed mattzuba closed 7 years ago

mattzuba commented 7 years ago

I'm not sure if this is an issue in rollup-watch or in rollup itself, but something I've noticed that is causing me headaches with my React app is that when I initially bundle and start watching, my app works great and the bundle is exactly as I expect it. If I make the tinest change to a single file, simply adding a new line (\n), and saving so that watch picks it up and rebundles, my bundle is now about 33% larger in size, and running a diff between the last bundle and the new one reveals tons of duplicated code added to the new bundle. This process keeps happening as changes and new bundles are generated - an initial bundle that was around 3MB in size grew to 20MB after not too long. Restarting the watch process brought it back down to the expected 3MB, but again, it just grew again after a short time of changing files and rebundling.

talmobi commented 7 years ago

Hmm, could you try and see if it happens with https://www.npmjs.com/package/wrollup?

If it does it's probably a rollup issue and not a rollup-watch issue. Also which rollup version are you using and what kind of rollup.config.js?

Thanks

mattzuba commented 7 years ago

I did some further testing and realized this is an issue because of a custom rollup plugin I created to prepend some javascript to the top of the generated bundle. I pulled that plugin out and now everything is mostly okay, except the incremental builds are missing comments, whereas the initial build has them. That's not too big of a deal though. Not sure if it warrants another bug report somewhere else, but I'll close this for now.