fix: track sync-loaded files as webpack dependencies#596
Merged
Conversation
|
Less's `data-uri()` built-in and any custom Less function (including those installed via `@plugin`) load files synchronously. Webpack no longer exposes a sync resolver, so the file manager previously signalled `supportsSync: false` and let Less's default file manager handle the sync read - meaning those files were never added to webpack's file dependency set. With persistent caching enabled, changes to a file used only via `data-uri()` would not invalidate the cached bundle. The file manager now fulfils sync reads itself (delegating the actual read to the parent class's `loadFile` with `syncImport: true`), records the resolved filename as a dependency, and kicks off an async webpack resolve in parallel so aliased / webpack-only resolutions also feed into the dependency set. The loader awaits these tasks before completing. Closes #492
8966287 to
2c30390
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #596 +/- ##
==========================================
- Coverage 96.94% 96.72% -0.22%
==========================================
Files 2 2
Lines 556 642 +86
==========================================
+ Hits 539 621 +82
- Misses 17 21 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Less's
data-uri()built-in and any custom Less function (includingthose installed via
@plugin) load files synchronously. Webpack nolonger exposes a sync resolver, so the file manager previously signalled
supportsSync: falseand let Less's default file manager handle thesync read - meaning those files were never added to webpack's file
dependency set. With persistent caching enabled, changes to a file used
only via
data-uri()would not invalidate the cached bundle.The file manager now fulfils sync reads itself (delegating the actual
read to the parent class's
loadFilewithsyncImport: true), recordsthe resolved filename as a dependency, and kicks off an async webpack
resolve in parallel so aliased / webpack-only resolutions also feed into
the dependency set. The loader awaits these tasks before completing.
Closes #492