Webpack incremental build does not work
According to Webpack5 documentation in order to utilize incremental build I need to pass cache object with type: "filesystem" however that does nothing when I pass it through Grunt-webpack and the documentation for Grunt-webpack refer to cache as a Boolean.
If anyone in the future wonders how I resolved this issue the solution for me was to remove grunt-webpack and to run webpack from cli using grunt-shell and it indeed builds incrementally.
Makes sense. Grunt suppress output and input a lot more than needed. Like error handling.
I found the problem, this is a straight up bug in grunt-webpack: grunt-webpack never calls compiler.close(), see a description of the issue in webpack's issue tracker https://github.com/webpack/webpack/issues/12342#issuecomment-754869202
If you look in tasks/webpack.js you can see that compiler is created as const compiler = webpack(webpackOptions);, but compiler.close() is never called. In Webpack 5, compiler.close() is what triggers webpack to write out the filesystem cache before exiting.
Here's a PR with a fairly simple fix that WorksForMe(TM): https://github.com/webpack/grunt-webpack/pull/250
This makes webpack 5 caching work with grunt-webpack.