Conversation
Reviewer's GuideThis PR refactors the WebpackImageSizesPlugin to streamline default option handling, optimize its execution by skipping redundant runs through build and config-change detection, refactors hook implementations for correct context and parameter usage, and updates the SCSS font mixin import path. Sequence Diagram for WebpackImageSizesPlugin Conditional ExecutionsequenceDiagram
participant C as WebpackCompiler
participant P as WebpackImageSizesPlugin
C->>P: Hook triggered (emit or watchRun) with Compilation
activate P
P->>P: runGeneration(compilation, callback)
alt Initial build OR confImgPath changed in compilation.modifiedFiles
P->>P: Set hasBeenBuiltOnce = true
P->>P: Log "Starting WebpackImageSizesPlugin generation..."
P-->>P: Perform image processing tasks
P->>C: callback()
else Not initial build AND no changes in confImgPath
P->>P: Log "No changes detected in confImgPath"
P-->>P: Skip image generation
P->>C: callback()
end
deactivate P
Updated Class Diagram for WebpackImageSizesPluginclassDiagram
class WebpackImageSizesPlugin {
+boolean hasBeenBuiltOnce$
+constructor(options: Object)
+apply(compiler: WebpackCompiler)
+generateDefaultImages(context: string, imageSizes: Object)
}
State Diagram for WebpackImageSizesPlugin Build StatusstateDiagram-v2
[*] --> NotBuiltYet : Initial State
NotBuiltYet: Plugin has not run successfully yet.
BuiltOnce: Plugin has run successfully at least once.
NotBuiltYet --> BuiltOnce : First successful runGeneration completes
BuiltOnce --> BuiltOnce : Subsequent runGeneration (executes or skips based on changes)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @n-langle - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
Traiter les retours de Sourcery. |
firestar300
requested changes
Jun 4, 2025
firestar300
approved these changes
Jun 17, 2025
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.
Prevent webpack image sizes plugin to be called too many times
Summary by Sourcery
Optimize the WebpackImageSizesPlugin to avoid repeated invocations by tracking build state and file changes, streamline its initialization logic, and correct the SCSS import path for Poppins font mixins.
Enhancements: