Webpack 5.0.0-beta.X compilation.getCache Error
1 min readAug 4, 2020
If you’re here, chances are you ran into the following surprise in your Webpack 5-beta build:
TypeError: compilation.getCache is not a function
To fix, you’ll need to update to Webpack 5.0.0-beta.23, which introduces getCache.
From the release notes:
added
compilation/compiler.getCache
API for easier to use caching
So why did the error appear in the first place?
If you’re experiencing this in your build pipeline, it’s because it’s installing everything from scratch, and terser-webpack-plugin
is a caret’d dependency of webpack, which in our case, allows it to grab the latest terser-webpack-plugin
which uses the latest webpack cache API.