Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Name some benefits of using webpack
Home
GulpJS
Name some benefits of using webpack
0
votes
asked
Jul 13, 2021
in
GulpJS
by
SakshiSharma
Name some benefits of using webpack
webpack-benefits
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jul 13, 2021
by
SakshiSharma
Webpack and static assets
in a dependency graph offers many benefits. Here's a few:
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.
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.
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.
Stable production deploys. You can't accidentally deploy code with images missing, or outdated styles.
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.
Webpack is the main build tool adopted by the React community.
...