S
S
Sergey Kondrashevsky2020-08-18 16:00:41
JavaScript
Sergey Kondrashevsky, 2020-08-18 16:00:41

Why long webpack build?

Hey!
Help me figure out why Webpack build takes a long time
. Approximately 7 - 15 seconds are needed to build and reload.
Here is the project

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tis-cake, 2021-03-13
@Seryoga96

The problem is imagemin-webpack-plugin .
The fact is that the minification of images occurs not only with each launch of the assembly, but also with each recompilation.
To avoid re-minification - you can cache minified images. The plugin has an option cacheFolder , which specifies the path to the folder where the cache files will be stored.
Documentation.
Sample code:

new ImageminWebpackPlugin({
  cacheFolder: path.resolve(__dirname, 'src/cache'),
  test: /\.(jpe?g|png|gif|svg)$/,
  disable: isProd,
  pngquant: {
    quality: '75',
  },
}),

A
Alexander Balya, 2020-08-20
@Balya

ImageminWebpWebpackPlugin can take a long time to process images. Try disabling it and check.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question