You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

1 Días
9 Hrs
26 Min
21 Seg

¿Por qué necesitamos un empaquetador de módulos?

4/23
Resources

Why are module packers important in JavaScript?

Module packers are essential tools for modern JavaScript application development. This type of software not only organizes your code, but also optimizes the process of building your applications. But how exactly do they work and what are their benefits? Here we break down how you can make the most of packagers for your projects and explore some of the most common ones, such as Webpack, Parcel, Sbill, Rolub, and Bait.

How do module packers work?

A packager analyzes your code and decides how to handle it, processing different types of files and resources, such as stylesheets (CSS, SASS), JavaScript scripts (JS, MJS), and even TypeScript (TSX). Once configured, a packager like Webpack takes all these resources and combines them into one or more optimized files.

  1. Identification and configuration: Webpack, for example, reads each of your resources via loaders and plugins configured in a specific file.

  2. Optimization and compilation: It then optimizes these resources - split into multiple modules - by merging them into one or more minified JavaScript and unified CSS files, ready for production.

  3. Logical organization: Allows for an architectural organization, keeping the modules and styles of the different parts of your application separate.

  4. Compatibility and continuous improvement: Adapts to new technologies and updates to the ECMAScript standard, allowing implementations such as Dynamic Imports.

What are the benefits of using a module packager?

The use of packagers such as Webpack provides several benefits for the development of your application.

  • Improved performance: By unifying and minifying files, the application load time decreases considerably.
  • Ease of maintenance: Organize the code in a way that simplifies its maintenance and scalability.
  • Guaranteed compatibility: Prepares styles and scripts for any browser.
  • Optimized resource loading: Uses techniques such as Dynamic Import to load only what is strictly necessary when required.

How to incorporate new technologies with packers?

Packagers allow easy incorporation of new technologies, for example:

  • TypeScript support: Through configuration, you can integrate TypeScript for better type handling and code optimization.
  • Integration of new fonts and styles: You can load and optimize new fonts according to project needs.
  • Continuous implementation of ECMAScript enhancements: New features of the standard, such as Dynamic Import, can be easily applied to break up code and improve the user experience.

What will we explore in an advanced packager course?

Over the course of one course, you will have the opportunity to build at least five projects using different packagers. You will learn from initial setup to fully automating a project for production. This includes:

  • Configuration of scripts and dependencies.
  • Use of plugins and loaders.
  • Creation of diverse projects: from simple websites to sophisticated applications that handle the DOM and use APIs.

With this knowledge, you will be prepared to maximize the capabilities of any packager and build more efficient and adaptable applications. Keep learning and discover the endless possibilities that these powerful resources offer for your development projects!

Contributions 5

Questions 2

Sort by:

Want to see more contributions, questions and answers from the community?

Un empaquetador te permite gestionar tu código, ver que se utiliza y que no, poner restricciones y reglar, ver que tipo de recursos admitir también como referenciar estos recursos al momento de hacer un deploy a producción para gestionar mejor el tema de optimización y seguridad.

Resumen: Optimizan todo nuestro código y recursos para llevarlo a producción

Antes no me gustaba como el profe daba las explicaciones, sentía que le daba muchas vueltas al asunto.
.
Sin embargo en esta clase, me gusto como explicó el concepto. No se si será porque yo ya tengo un conocimiento más amplio del desarrollo web y ya entiendio lo que dice o porque el profe mejoro su manera de explicar.
.
Talvez un poco de ambos

![](https://static.platzi.com/media/user_upload/image-7a5e6eaf-d9ad-400b-8474-45881c483fac.jpg)![](https://static.platzi.com/media/user_upload/webpack-a4dbb7c4-94c6-41c7-b87f-4eda4de39e34.jpg)
La necesidad de usar un empaquetador web nace a partir del crecimiento de un proyecto web. Una aplicación web se compone de muchos módulos pequeños, que al final se unen para formar una aplicación entera, dentro de nuestros módulos tenemos archivos de todo tipo, por lo que se hace uso de una arquitectura para organizar todos los archivos de nuestra aplicación en diferentes directorios. El trabajo del empaquetador web es tomar como entrada todos los archivos que componen nuestra aplicación, realiza una serie de procesos pre configurados sobre estos archivos dependiendo qué tipo de archivo sea, y finalmente entregar un paquete de archivos que será nuestro proyecto listo para ejecutarse en producción. Algunos de los procesos que ocurren en el empaquetador web pueden ser: * Minificación de código. * Compresión de imágenes. * Eliminación de código muerto (código que no se usa). * Modularización de código. * Carga diferida de módulos. Además, estos también se pueden integrar con otras herramientas, como compiladores de código (como Babel), preprocesadores de CSS (como Sass) y sistemas de construcción (como Gulp).