Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

[Draft] Fix webpack 5 persistent cache invalidation #5

Closed
wants to merge 5 commits into from

Conversation

thecrypticace
Copy link
Collaborator

@thecrypticace thecrypticace commented Mar 3, 2021

There are a couple of things we do here:

  1. Register each changed file as a dependency of the build. This also keeps a persistent list of all dependencies during a given watch cycle.
  2. Ensure dependencies are absolute paths. If they are not webpack will resolve them, afaict, relative to the file that caused the dependency to be added not the working dir or project root.
  3. Ensure the temporary touch file is cleaned up when rebooting the watcher.

TODO: Figure out how to handle files that were added between builds. The general way to do this would be to register whole directories as build dependencies with webpack however doing so requires a webpack plugin.

TODO: This looks like causes the cache pack file to be invalidated when recompiling so new files are picked up. I do not know why this is however so I need to be sure it doesn't break in the future.

If we’re recording these as dependencies we must have the absolute paths. If we don’t they may (and generally will) be resolved incorrectly.
This makes for easier debugging so we can touch the file manually to see if it triggers a rebuild. Or to see if it was properly deleted when the process exited.
These are not always removed on process exit and definitely not removed when rebooting the watcher.
@thecrypticace thecrypticace changed the title Fix webpack 5 persistent cache invalidation [Draft] Fix webpack 5 persistent cache invalidation Mar 3, 2021
@thecrypticace
Copy link
Collaborator Author

This was superseded by the other PR.

@adamwathan adamwathan deleted the feature/fix-wp5-cache-problems branch March 15, 2021 16:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant