fix: preserve compiler paths for shared plugin instances - #725
Conversation
🦋 Changeset detectedLatest commit: 8fabe1a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
| async generateStatsFile(stats) { | ||
| async generateStatsFile( | ||
| stats, | ||
| compiler = /** @type {Compiler} */ (this.compiler), |
There was a problem hiding this comment.
Is there a reason to allow leaving out the compiler argument now? This looks like AI using protective coding pattern over understanding if this default is what we want or not.
There was a problem hiding this comment.
Good catch — there was no real need for the default. The hook already threads the actual compiler through every internal call site, so I removed the this.compiler fallback and made the parameter required in 8fabe1a.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #725 +/- ##
=======================================
Coverage 76.29% 76.29%
=======================================
Files 17 17
Lines 983 983
Branches 357 358 +1
=======================================
Hits 750 750
Misses 206 206
Partials 27 27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
valscion
left a comment
There was a problem hiding this comment.
Looks good to me!
Also, noticed that analyzerMode === "server" is not really covered even in base branch so those changed lines also can't be verified by CI... would be lovely to see a change that would add missing coverage for that.
Summary
Fixes #506.
A
BundleAnalyzerPlugininstance can be applied to multiple compilers, but the plugin previously stored only the most recently applied compiler. As a result, every done-hook callback resolved bundle assets and report files against that compiler's output directory.This change:
Testing
npm exec -- jest test/plugin.js --runInBand --testNamePattern=should.use.each.compiler.output.path(2 passed)npm exec -- jest test/viewer.js --runInBand(5 passed)npm exec -- eslint src/BundleAnalyzerPlugin.js src/viewer.js test/plugin.jsnpm exec -- tsc --pretty --noEmitnpm exec -- prettier --check src/BundleAnalyzerPlugin.js src/viewer.js test/plugin.js .changeset/calm-compilers-report.mdnpm run build