question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BuildDependencies in cache not update

See original GitHub issue

Bug report

What is the current behavior? I’m using webpack to bundle my project, if BuildDependencies in cache configuration is updated but the cache pack is not invalid, the pack will not updated.

If the current behavior is a bug, please provide the steps to reproduce. Use this repo: https://github.com/killagu/webpack-cache-bug/

  1. Run npm run build
  2. Run npm run build2

The cache will not update.

What is the expected behavior? Update the cache to ensure all BuildDependencies will be checked in next bundle.

Other relevant information: webpack version: 5.48.0 Node.js version: v14.16.0 Operating System: MacOS Additional tools:

How to fix it?

// https://github.com/webpack/webpack/blob/main/lib/cache/PackFileCacheStrategy.js#L1116
- if (!pack.invalid) return;
this.logger.log(`Storing pack...`);
let promise;
const newBuildDependencies = new Set();
for (const dep of this.newBuildDependencies) {
	if (!this.buildDependencies.has(dep)) {
		newBuildDependencies.add(dep);
	}
}
+ if (!pack.invalid && !newBuildDependencies.size) return;

If it’s right, I’m glad to fix it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Aug 5, 2021

Anyway let’s mark it as enhancement

0reactions
sokracommented, Nov 5, 2021

Deleting build dependencies is not valid. They have to stay in the cache, since cache entries have been created with these build dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically refresh caches when build dependencies are ...
In this blog post, we are sharing a solution that can help to invalidate and refresh the cache automatically whenever there is a...
Read more >
Having trouble with Gradle dependencies not updating
I build and install one of the common jars, and the maven repo has it, but the Gradle cache still has a jar...
Read more >
Updating a dependency is not invalidating other application's ...
When updating a shared library, it's not invalidating the cache of projects that depend on that library. I am updating a component called...
Read more >
Pipelines caches with node does not refresh dependencies ...
The cache does not update. Upon build and install it works because the local node_modules gets updated, but the cached version doesn't get...
Read more >
Caching Dependencies - CircleCI
Caching is one of the most effective ways to make jobs faster on CircleCI. ... Automatic dependency caching is not available in CircleCI,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found