Why do Webpack 5 return a non-zero error code for performance hints?

595 views Asked by At

Background

I've just upgraded a project from Webpack 4 to Webpack 5. With the new version, it seems as if any performance hints (warnings) will make Webpack CLI to return a non-zero error code 1 when exiting the process.

This breaks my production builds, where I use npm run --silent to execute the webpack script.

Workaround

If I remove performance hints in config file, no error code will be returned.

performance: {
   hints: false, //"warning",
},

Question

In Webpack 4, these hints did not return any error code.

How can I enable the performance hints as warnings in Webpack 5 - without getting a non-zero exit code?

1

There are 1 answers

0
joakimriedel On BEST ANSWER

This seems to have been due to a bug in the beta builds of Webpack 5. With the final 5.0 version a non-zero exit code will be produced for warnings.