DEV Community

Cover image for A Future Without Webpack

A Future Without Webpack

Fred K. Schott on August 02, 2019

Note: This piece was originally published to pika.dev. The year is 1941. Your name is Richard Hubbell. You work at an experimental New York televi...
Collapse
 
ben profile image
Ben Halpern

I can’t get about got the pika logo 😄

Collapse
 
fredkschott profile image
Fred K. Schott

Check out our list of examples for how to set up an app or even a PWA: github.com/pikapkg/web/blob/master...

@pika/web is not a server, so you'll need a static file server for local development. Something like npmjs.com/package/serve with live reload configured.

Collapse
 
slashgear_ profile image
Antoine Caron

Hey !

First, this is a great article.

Bundler should not be required for webdev :)

I really think Compression is a big deal.
Splitting file to file will increase runtime caching but will destroy Gzip or Brotli power.

Collapse
 
fredkschott profile image
Fred K. Schott

For sure, it all comes down to a balance between the caching improvements that you get, the total downloaded efficiency that you get (no downloading code you don't need), and the compression efficiency of that first download.

One of my favorite things about this strategy is that it's great when you're just starting out and performance isn't your immediate concern. No need to wrestle with a ton of tools just to get a prototype or demo or simple site out there. And then, when you are ready to optimize for production users, you're free to add a bundler to your toolkit if that's what you'd prefer.

Collapse
 
nickytonline profile image
Nick Taylor

Great first post. I had heard of pika, but didn't realize how it worked. Looking forward to your next post!

Collapse
 
sinni800 profile image
sinni800

Does having "1300 dependencies for Hello World" mean that this will create 1300 dependencies that have to be reloaded with a js file each?

Collapse
 
fredkschott profile image
Fred K. Schott

Not necessarily, the point was more towards how complex the "starter" Create React App build pipeline. Most of those are Node-only packages specifically for building your app.

Collapse
 
zenwork profile image
Florian Hehlen

FYI... react-script is not the npm name of Create React App.

Collapse
 
alexvpopov profile image
Alex Popov • Edited

I there anyone who has managed to replace webpack/webpacker in a Rails app with pika? If so, please share.

Collapse
 
fredkschott profile image
Fred K. Schott

Pika works with any server, you would just need to install your web_modules directory to somewhere that Rails would serve it to the browser (app/assets/web_modules?) and then just write your JS imports to point to their final location when served.

We have a few examples here: github.com/pikapkg/web/blob/master...
If you do get it working with Rails, would love if you could add it there!

Collapse
 
drsensor profile image
૮༼⚆︿⚆༽つ • Edited

But rollup still needed because pika use that as dependencies 😋

Collapse
 
fredkschott profile image
Fred K. Schott

Totally! I get to touch on that more in this talk: youtu.be/2Wwx-lF5NhE?t=711

If you don't have time to watch, the tl;dr is that we get to move bundling complexity away from the app (where it's no longer needed) and down to only the dependencies. It's not an attempt to get rid of bundling, but more to refocus it for 2019 on bundling's original purpose:

  1. as a production optimization
  2. as a way to consume npm on the web