0 votes
in GulpJS by
Name some benefits of using webpack

1 Answer

0 votes
by

Webpack and static assets in a dependency graph offers many benefits. Here's a few:

  1. Dead asset elimination. This is killer, especially for CSS rules. You only build the images and CSS into your dist/ folder that your application actually needs.
  2. Easier code splitting. For example, because you know that your file Homepage.js only requires specific CSS files, Webpack could easily build a homepage.css file to greatly reduce initial file size.
  3. You control how assets are processed. If an image is below a certain size, you could base64 encode it directly into your Javascript for fewer HTTP requests. If a JSON file is too big, you can load it from a URL. You can require('./style.less') and it's automaticaly parsed by Less into vanilla CSS.
  4. Stable production deploys. You can't accidentally deploy code with images missing, or outdated styles.
  5. Webpack will slow you down at the start, but give you great speed benefits when used correctly. You get hot page reloading. True CSS management. CDN cache busting because Webpack automatically changes file names to hashes of the file contents, etc.
  6. Webpack is the main build tool adopted by the React community.

Related questions

0 votes
asked Jul 13, 2021 in GulpJS by SakshiSharma
0 votes
0 votes
asked Aug 27, 2023 in Apache Drill by john ganales
...