@@ -56,7 +56,8 @@ export function getRspackPlugin<UserOptions = Record<string, never>>(
5656 if ( plugin . resolveId ) {
5757 const vfs = new FakeVirtualModulesPlugin ( plugin )
5858 vfs . apply ( compiler )
59- plugin . __vfsModules = new Map ( )
59+ const vfsModules = new Map < string , Promise < string > > ( )
60+ plugin . __vfsModules = vfsModules
6061 plugin . __vfs = vfs as any
6162
6263 compiler . hooks . compilation . tap ( plugin . name , ( compilation , { normalModuleFactory } ) => {
@@ -104,15 +105,15 @@ export function getRspackPlugin<UserOptions = Record<string, never>>(
104105 // If the resolved module does not exist,
105106 // we treat it as a virtual module
106107 if ( ! fs . existsSync ( resolved ) ) {
107- if ( ! plugin . __vfsModules ! . has ( resolved ) ) {
108+ if ( ! vfsModules . has ( resolved ) ) {
108109 const fsPromise = vfs . writeModule ( resolved )
109- plugin . __vfsModules ! . set ( resolved , fsPromise )
110+ vfsModules . set ( resolved , fsPromise )
110111 await fsPromise
111112 }
112113 else {
113114 // Ensure that the module is written to the virtual file system
114115 // before we use it.
115- await plugin . __vfsModules ! . get ( resolved )
116+ await vfsModules . get ( resolved )
116117 }
117118 resolved = encodeVirtualModuleId ( resolved , plugin )
118119 }
0 commit comments