The following error message is usually related to running out of memory during a job:
Failed to minify the bundle. Error: static/js/12.fb78ba11.chunk.js from Terser
Error: Call retries were exceeded
Webpack4 starts using terser-webpack-plugin
to minify your JavaScript as default. The default parallel option in terser-webpack-plugin
is set to the number of CPUs (os.cpus().length - 1)
. It means the function references the actual VM's CPU count, and it's a bigger number of CPUs than the docker executor has. Therefore, Webpack will make more workers than the vCPU counts, and it causes this error.
To work around this, you will need to specify the parallel option to set to the same number as the vCPUs. For example:
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimizer: [
new TerserPlugin({
parallel: 2,
}),
],
}
};
More information about this can be found at the links below:
https://webpack.js.org/configuration/optimization/#optimizationminimizer
https://webpack.js.org/plugins/terser-webpack-plugin/#parallel
If it doesn't solve the problem, there are a couple of options you can try:
- Increase the resource class in use to provide more memory to the job
- Adjust the "max_old_space_size" for NodeJS to a suitable value. For example, if you are using the medium resource class with 4GB of memory, then set this to 3GB.
For additional visibility on memory usage issues, consider logging the maximum memory usage for the job.
Comments
Article is closed for comments.