You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
invalidate(id: string, isTransformDependency: boolean) {
this.invalidated = true;
if (isTransformDependency) {
- (this.cache.modules as ModuleJSON[]).forEach(module => {- if (!module.transformDependencies || module.transformDependencies.indexOf(id) === -1)- return;+ for (const module of this.cache.modules) {+ if (module.transformDependencies.indexOf(id) === -1) return;
// effective invalidation
module.originalCode = null as any;
- });+ }
}
this.watcher.invalidate(id);
}
When this code was refactored from this.cache.modules.forEach(..) to for(const module of this.cache.modules) { ... }, the return wasn't changed to a continue, so as soon as the first module that doesn't have a matching id in transformDependencies is found it halts iteration.
The text was updated successfully, but these errors were encountered:
tivac
added a commit
to tivac/rollup
that referenced
this issue
Sep 12, 2019
tivac
changed the title
.addWatchFiles don't always trigger rebuilds in 1.21.0+
.addWatchFiles() dependencies can fail to trigger rebuilds in 1.21.0+
Sep 13, 2019
How Do We Reproduce?
https://gist.github.com/tivac/ca2ff933d6dac4e06e8264800b0a1f98
Expected Behavior
Dependencies expressed using
this.addWatchFile()
would trigger invalidation of the calling module whenever the dependency changes.Actual Behavior
The calling module is not invalidated.
Bug explanation
This bug was introduced by #3081 (which is an awesome change and a huge QoL improvement), but just cost me an evening chasing down a subtle issue.
Here's the specific problematic change.
When this code was refactored from
this.cache.modules.forEach(..)
tofor(const module of this.cache.modules) { ... }
, thereturn
wasn't changed to acontinue
, so as soon as the first module that doesn't have a matching id intransformDependencies
is found it halts iteration.The text was updated successfully, but these errors were encountered: