Skip to content

Commit eb5738a

Browse files
committed
add constructorName for module on js side
1 parent 2ac4a21 commit eb5738a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/rspack/src/Module.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ const BUILD_META_MAPPINGS = new Map<string, Record<string, any>>();
203203
export class Module {
204204
#inner: JsModule;
205205
#identifier: string | undefined;
206+
#constructorName: string | undefined;
206207
#type: string | undefined;
207208
#layer: string | undefined | null;
208209
#context: string | undefined | null;
@@ -271,6 +272,15 @@ export class Module {
271272
}
272273

273274
Object.defineProperties(this, {
275+
constructorName: {
276+
enumerable: true,
277+
get: (): string => {
278+
if (this.#constructorName === undefined) {
279+
this.#constructorName = module.constructorName;
280+
}
281+
return this.#constructorName;
282+
}
283+
},
274284
type: {
275285
enumerable: true,
276286
get: (): string => {

0 commit comments

Comments
 (0)