DEV Community

Nguyen Kim Son
Nguyen Kim Son

Posted on

You don't have to use Webpack

Nowadays, webpack seems inevitable for a web developer.

But for a conventional, i.e., not a single-page application, using webpack can feel awkward because:

  • there's no need to have a single JS file: each page is independent and their JS code needs to be isolated.

  • there isn't much JS code for a conventional web app.

As a web developer, I sometimes feel the urge of adding Webpack to our flow but I just can't justify the utility. Don't get me wrong, I have been using Webpack since its beginning for several SPA projects but it just doesn't add any major productivity boost for our conventional web app.

Sure, with the right configuration, Webpack will help writing the code a bit easier but I'd rather spend the setup and config time on adding features that actually bring values for users. This is even more important for a new project where you want to quickly validate the idea.

Our open-source web app doesn't use Webpack and we never felt the lack of it slows down the development nor affect the code quality.

In fact, we use inline JS and the JS code lives in the same file as the HTML and CSS. That config is nice to work with as you know changes are isolated. In this regard, our page is similar to a VueJS single-file component. And yeah, we use jQuery đŸ˜±.

So if you don't find the need of using Webpack in your project and somehow feel shameful about it, don't as you aren't alone!

Latest comments (3)

Collapse
 
killawabbit profile image
Henrik VĂ„glin

What about Parcel if you don’t like to do much configuring? And new webpack alternatives for a nicer developer experience like Snowpack, have you given them a try?

I do sympatize that if using any bundler seems like a waste of time, then of course you shouldn’t need to set one up - however there are options that might suit your needs better is all I’m saying.

Collapse
 
sonnk profile image
Nguyen Kim Son

Parcel seems really nice and corresponds to what we need indeed. Would definitely give it a try!

Collapse
 
yellow1912 profile image
yellow1912

I use npm scripts to do lots of things, including watching and building css and svg icons. I don't like the fact that with webpack you have to create a js file to include your css, then use an additional module if you want to output your case separately. That was one of those wtf moments I ran into with webpack.

That said, I'm still using webpack for is files, mainly to watch, build, transpile and minify. Maybe some day I can break away completely from webpack, for now I'm still stuck with it. Watching hundreds of js files and rebuild them can be slow with npm scripts.