Fireship · @fireship
Module Bundlers Explained... Webpack, Rollup, Parcel, and Snowpack
Uploaded October 22, 2020 · Length 9:56
Summary
This video explains how to use module bundlers like Webpack, Rollup, Parcel, and Snowpack to manage JavaScript dependencies in web applications.
- module bundlers
- webpack
- rollup
- parcel
- snowpack
- javascript dependencies
- web development
- front end development
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
to build a website you only need three
- 0:02
ingredients html css and javascript
- 0:05
that sounds pretty straightforward on
- 0:06
the surface but here's the problem
- 0:08
nobody just uses html css and javascript
- 0:11
to build a website
- 0:12
you might replace javascript with
- 0:13
typescript then throw in a ui library
- 0:15
like react
- 0:16
to replace html you'll definitely need a
- 0:18
css preprocessor like sas
- 0:20
then you'll need to import a whole bunch
- 0:21
of third-party modules so you're not
- 0:23
doing everything from scratch many of
- 0:24
your dependencies might use common js
- 0:26
which isn't going to work with your
- 0:27
modern es module syntax the code will
- 0:29
have name collisions all over the place
- 0:31
and even if you do manage to get it to
- 0:33
work you'll likely end up with a massive
- 0:34
javascript file which then needs to be
- 0:36
minified
- 0:37
and broken into smaller chunks just so
- 0:39
people can visit your site with a
- 0:40
reasonable load time you'll also need to
- 0:42
create different versions of your
- 0:43
javascript and load polyfills to ensure
- 0:45
that your code works on legacy browsers
- 0:47
as a developer it's like being asked to
- 0:48
land on the moon with a lawn chair and
- 0:50
some balloons tied to it
- 0:52
it's truly the most annoying aspect of
- 0:53
building a web application
- 0:55
but thankfully we have module bundlers
- 0:56
which make this entire process
- 0:58
a little less annoying in today's video
- 1:00
you'll learn everything you ever wanted
- 1:01
to know about module bundlers
- 1:03
like webpack roll up parcel and snowpack
- 1:05
we'll primarily focus on webpack because
- 1:07
it's the most popular
- 1:08
but most of the core concepts that we'll
- 1:10
look at apply to all of them but make
- 1:12
sure to watch until the end when we look
- 1:13
at snowpack
- 1:14
because it uses a technique that is much
- 1:16
different than the others and represents
- 1:18
what i think will be the future of front
- 1:19
end web development if you're new here
- 1:21
like and subscribe and consider becoming
- 1:22
a pro member at fireship io or sponsor
- 1:25
me on github for even more content let's
- 1:27
start by answering the question of what
- 1:28
is a module bundler
- 1:30
i already presented a long list of
- 1:31
problems and the role of the module
- 1:33
bundler is to fix these problems
- 1:35
the most fundamental thing they do is
- 1:36
take multiple javascript files
- 1:38
and combine them into a single large
- 1:40
file that can be then used in the
- 1:42
browser to load your javascript app
- 1:44
this file or the javascript bundle as
- 1:46
it's called contains your source code
- 1:48
along with any third-party dependencies
- 1:49
that you've imported
- 1:50
your dependencies also likely have their
- 1:52
own dependencies that need to be
- 1:54
imported
- 1:54
a bundler like webpack creates a
- 1:56
dependency graph to keep track of how to
- 1:58
put everything together
- 1:59
you just tell webpack where to find your


