I use the file cache of Webpack5 through the following configuration, and set the cache files in a public folder
In the case of the file directory structure unchanged, build again. At this time, caching can be applied successfully, greatly reducing the build time
I copied the entire project code to the same directory as testbuild
Under the new directory testBuild, execute the build and find that the previously generated cache is not applied. It generates new ones
Supplementary Note: This test is to simulate the real CI construction process, and my goal is to significantly reduce the build time on CI construction
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(paths.cachePath,'prod-cache'),
}