filmov
tv
Webpack in 100 Seconds

Показать описание
Webpack in 100 Seconds, by QuickDev.
Topics Covered:
What is webpack?
Is webpack worth learning?
What does webpack do?
Getting started with webpack
Module builders explained.
Webpack Config Explained
Webpack Demo.
Javascript Module Builders
In the old days, all you needed for a website was a HTML file. You add some CSS for styling and Javascript for interaction. And that’s it.
But things have changed. Nowadays, you probably want a UI library like react. Maybe Firebase for storing data. Auth0 for login. Stripe for payments. The list goes on and on.
Some of those modules use commonjs, and some are ES modules. You need to minify your code so that load times are actually decent. And, you need to make sure all your code is included in the right order. It’s a developer’s nightmare.
The solution? Webpack. Webpack is a module builder. It’s main purpose is to bundle many javascript files into a single file. It automatically handles dependencies, transpiling ES and Commonjs modules, and improves load times by minifying your code. You can also use webpack plugins to do a variety of other things, like converting HTML code into Javascript that’s injected on runtime, obfuscating code, and even storing assets in base64 format.
Here I've created a simple to-do list. Let’s see how we can use webpack to convert all my javascript files into one single bundle. First, install webpack from npm. Then, we can create a config file that specifies options to webpack. Now, to actually bundle the code, we can run webpack with a specified config file. There we go, we have the bundle. Now we can import this bundle on our html, and it works!
Subscribe for more content like this (IT'S FREE)
#webpack #javascript #coding
Topics Covered:
What is webpack?
Is webpack worth learning?
What does webpack do?
Getting started with webpack
Module builders explained.
Webpack Config Explained
Webpack Demo.
Javascript Module Builders
In the old days, all you needed for a website was a HTML file. You add some CSS for styling and Javascript for interaction. And that’s it.
But things have changed. Nowadays, you probably want a UI library like react. Maybe Firebase for storing data. Auth0 for login. Stripe for payments. The list goes on and on.
Some of those modules use commonjs, and some are ES modules. You need to minify your code so that load times are actually decent. And, you need to make sure all your code is included in the right order. It’s a developer’s nightmare.
The solution? Webpack. Webpack is a module builder. It’s main purpose is to bundle many javascript files into a single file. It automatically handles dependencies, transpiling ES and Commonjs modules, and improves load times by minifying your code. You can also use webpack plugins to do a variety of other things, like converting HTML code into Javascript that’s injected on runtime, obfuscating code, and even storing assets in base64 format.
Here I've created a simple to-do list. Let’s see how we can use webpack to convert all my javascript files into one single bundle. First, install webpack from npm. Then, we can create a config file that specifies options to webpack. Now, to actually bundle the code, we can run webpack with a specified config file. There we go, we have the bundle. Now we can import this bundle on our html, and it works!
Subscribe for more content like this (IT'S FREE)
#webpack #javascript #coding
Комментарии