[BUGFIX] rsbuild: handle plugin version - #773
Draft
Gladorme wants to merge 1 commit into
Draft
Conversation
Gladorme
force-pushed
the
versioning-lock
branch
from
August 19, 2026 13:41
78881d8 to
2b617b8
Compare
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Gladorme
force-pushed
the
versioning-lock
branch
from
August 19, 2026 13:42
2b617b8 to
8f05623
Compare
jgbernalp
reviewed
Aug 19, 2026
| if (process.env.NODE_ENV !== 'development') { | ||
| config.output.publicPath = 'auto'; | ||
| } | ||
| // Isolate each version's webpack runtime. |
Contributor
There was a problem hiding this comment.
this probably is not needed as we should use the path, regardless if the chunk has the same name
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.
Description
In spec of plugin we can define "metadata" (version + registry) and when I wanted to implement it on frontside, I got some issue when there is multiple instances of a same plugin with different versions.
Makes plugin builds version-aware so multiple versions of the same plugin can be installed and loaded side by side. Previously only the latest installed version of a plugin was actually loadable — any other version either failed to load or silently rendered the latest one's code.
1. Version in the asset prefix
getPublicPathnow returns/plugins/<name>~<version>/instead of/plugins/<name>/. The version is read from the plugin'spackage.jsonat build time.Why: a manifest fetched from
/plugins/<name>~<version>/mf-manifest.jsonresolved its (relative) remoteEntry against the version-less prefix. The server maps a path with no~versiontoLatestVersion, so an older version requested the latest version's directory. Since chunk filenames are content-hashed, the file didn't exist there:RUNTIME-008 ScriptNetworkError resourceUrl: /plugins/TimeSeriesChart/__mf/js/TimeSeriesChart.7c5da441.js (404)This also explains why the newest version always appeared to work, and why an older version worked right up until a newer archive was dropped in.
2. Version in the Module Federation container global name
Sets library:
{ type: 'global', name: '<Name>_<version>' }, so the manifest's globalName is unique per version.Why: MF resolves a remote's container via
globalThis[globalName], taken from the manifest (assignRemoteInfoin@module-federation/runtime-core), andloadEntryScriptearly-returns an already-registered container:With every version sharing the global name, the first version loaded won and later versions silently reused its container without ever fetching their own entry.
3. Version in the webpack chunk registry
Sets
output.uniqueNameandoutput.chunkLoadingGlobaltochunk_<Name>_<version>.Why: async chunks register into a shared global array:
When two versions share that global, the second one pushes its chunks into the runtime the first installed, and because module IDs are deterministic they collide: both versions resolve to the first one's modules.
chunkLoadingGlobalis set explicitly because rspack derives it fromuniqueNamebefore the tools.rspack hook runs, so settinguniqueNamealone is not enough.Plugins must be rebuilt for this to take effect; it is not retroactive for already-published archives
I did not handle registry name to have super long name, because I am not sure it will happen often 🙏
I guess if someone has the issue, he can change plugin name as quick win/fix
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes