Skip to content

Commit 9fd5f05

Browse files
committed
bug #905 Omit cache key entirely when build cache is disabled (weaverryan)
This PR was merged into the main branch. Discussion ---------- Omit cache key entirely when build cache is disabled Fixes an issue where `yarn watch` or `yarn dev-server` had super slow "rebuilds" - as long as the initial build, which is much different than the pre-1.0 version of Encore. It appears that cache: false is different than omitting the cache key entirely. Using cache: false appears to even disable in-memory caching that Webpack does when rebuilding in "watch" mode or for the dev-server Commits ------- 9282c77 omit cache key entirely when build cache is disabled
2 parents 54fa794 + 9282c77 commit 9fd5f05

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/config-generator.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ class ConfigGenerator {
6767
},
6868
plugins: this.buildPluginsConfig(),
6969
optimization: this.buildOptimizationConfig(),
70-
cache: this.buildCacheConfig(),
7170
watchOptions: this.buildWatchOptionsConfig(),
7271
devtool: false,
7372
};
7473

74+
if (this.webpackConfig.usePersistentCache) {
75+
config.cache = this.buildCacheConfig();
76+
}
77+
7578
if (this.webpackConfig.useSourceMaps) {
7679
if (this.webpackConfig.isProduction()) {
7780
// https://webpack.js.org/configuration/devtool/#for-production
@@ -511,10 +514,6 @@ class ConfigGenerator {
511514
}
512515

513516
buildCacheConfig() {
514-
if (!this.webpackConfig.usePersistentCache) {
515-
return false;
516-
}
517-
518517
const cache = {};
519518

520519
cache.type = 'filesystem';

0 commit comments

Comments
 (0)