@@ -119,11 +119,11 @@ export class ViteNodeServer {
119
119
return this . fetchPromiseMap . get ( id ) !
120
120
}
121
121
122
- async transformRequest ( id : string ) {
122
+ async transformRequest ( id : string , filepath = id ) {
123
123
// reuse transform for concurrent requests
124
124
if ( ! this . transformPromiseMap . has ( id ) ) {
125
125
this . transformPromiseMap . set ( id ,
126
- this . _transformRequest ( id )
126
+ this . _transformRequest ( id , filepath )
127
127
. finally ( ( ) => {
128
128
this . transformPromiseMap . delete ( id )
129
129
} ) ,
@@ -177,7 +177,7 @@ export class ViteNodeServer {
177
177
}
178
178
else {
179
179
const start = performance . now ( )
180
- const r = await this . _transformRequest ( id , transformMode )
180
+ const r = await this . _transformRequest ( id , filePath , transformMode )
181
181
duration = performance . now ( ) - start
182
182
result = { code : r ?. code , map : r ?. map as any }
183
183
}
@@ -191,15 +191,15 @@ export class ViteNodeServer {
191
191
return result
192
192
}
193
193
194
- protected async processTransformResult ( id : string , result : TransformResult ) {
195
- const mod = this . server . moduleGraph . getModuleById ( id )
194
+ protected async processTransformResult ( filepath : string , result : TransformResult ) {
195
+ const mod = this . server . moduleGraph . getModuleById ( filepath )
196
196
return withInlineSourcemap ( result , {
197
- filepath : mod ?. file || id ,
197
+ filepath : mod ?. file || filepath ,
198
198
root : this . server . config . root ,
199
199
} )
200
200
}
201
201
202
- private async _transformRequest ( id : string , customTransformMode ?: 'web' | 'ssr' ) {
202
+ private async _transformRequest ( id : string , filepath : string , customTransformMode ?: 'web' | 'ssr' ) {
203
203
debugRequest ( id )
204
204
205
205
let result : TransformResult | null = null
@@ -225,7 +225,7 @@ export class ViteNodeServer {
225
225
226
226
const sourcemap = this . options . sourcemap ?? 'inline'
227
227
if ( sourcemap === 'inline' && result && ! id . includes ( 'node_modules' ) )
228
- result = await this . processTransformResult ( id , result )
228
+ result = await this . processTransformResult ( filepath , result )
229
229
230
230
if ( this . options . debug ?. dumpModules )
231
231
await this . debugger ?. dumpFile ( id , result )
0 commit comments