Replies: 2 comments
|
The |
0 replies
I think it's intentional.
Given that this behavior is intentional, I would support introducing an |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context
I want to treat an optional configuration file, such as
tailwind.config.js, as a build dependency of webpack's filesystem cache.For example:
The build output may depend on whether this file exists:
Current behavior
When a directly configured
buildDependencycannot be resolved, webpack logs a warning similar to:The compilation can still succeed, but the filesystem pack cache cannot be successfully created or updated. Webpack does not appear to treat the unresolved path as a missing dependency automatically.
Expected behavior
I would expect the absence of an optional build dependency to be a valid snapshot state:
In other words, absence itself should not invalidate the cache repeatedly. A change in existence should invalidate it.
API gap
Webpack has
missingDependenciesandloaderContext.addMissingDependency(), but these are primarily associated with module snapshots and watch behavior.There does not appear to be an equivalent build-level API such as
cache.missingBuildDependencies, or a way to declare an optional build dependency:Webpack internally tracks
resolveDependencies.missing, but this is an output of build dependency resolution rather than a public input.Questions
cache.buildDependenciesand snapshot their missing resolution paths, or introduce an explicit optional/missing build dependency API?Related discussions
There is some precedent for optional transitive build dependencies:
That change allows missing dependencies discovered through
package.json#optionalDependencies, such asfsevents, to remain optional. However, it does not seem to cover optional build dependencies configured directly by users.All reactions