Webpack 5 cannot reuse caches in different file structures

Viewed 77
  1. I use the file cache of Webpack5 through the following configuration, and set the cache files in a public folder

  2. In the case of the file directory structure unchanged, build again. At this time, caching can be applied successfully, greatly reducing the build time

  3. I copied the entire project code to the same directory as testbuild

  4. Under the new directory testBuild, execute the build and find that the previously generated cache is not applied. It generates new ones

  5. 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'),
  }
0 Answers
Related