Merge pull request #15182 from webpack/bugfix/lib-ident-includes-layer

Module.libIdent is scoped by the module layer if there is one
This commit is contained in:
Tobias Koppers 2022-01-18 09:59:01 +01:00 committed by GitHub
commit c41eb368f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 8 deletions

View File

@ -275,6 +275,7 @@ class ContextModule extends Module {
this.context,
options.associatedObjectForCache
);
if (this.layer) identifier = `(${this.layer})/${identifier}`;
if (this.options.mode) {
identifier += ` ${this.options.mode}`;
}

View File

@ -355,11 +355,13 @@ class NormalModule extends Module {
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return contextify(
let ident = contextify(
options.context,
this.userRequest,
options.associatedObjectForCache
);
if (this.layer) ident = `(${this.layer})/${ident}`;
return ident;
}
/**

View File

@ -79,7 +79,9 @@ class ContainerEntryModule extends Module {
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return `webpack/container/entry/${this._name}`;
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${
this._name
}`;
}
/**

View File

@ -60,9 +60,9 @@ class FallbackModule extends Module {
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return `webpack/container/fallback/${this.requests[0]}/and ${
this.requests.length - 1
} more`;
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/fallback/${
this.requests[0]
}/and ${this.requests.length - 1} more`;
}
/**

View File

@ -67,7 +67,9 @@ class RemoteModule extends Module {
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return `webpack/container/remote/${this.request}`;
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/remote/${
this.request
}`;
}
/**

View File

@ -101,7 +101,9 @@ class ConsumeSharedModule extends Module {
*/
libIdent(options) {
const { shareKey, shareScope, import: request } = this.options;
return `webpack/sharing/consume/${shareScope}/${shareKey}${
return `${
this.layer ? `(${this.layer})/` : ""
}webpack/sharing/consume/${shareScope}/${shareKey}${
request ? `/${request}` : ""
}`;
}

View File

@ -67,7 +67,9 @@ class ProvideSharedModule extends Module {
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options) {
return `webpack/sharing/provide/${this._shareScope}/${this._name}`;
return `${this.layer ? `(${this.layer})/` : ""}webpack/sharing/provide/${
this._shareScope
}/${this._name}`;
}
/**