@@ -10,7 +10,6 @@ import {
1010import { transformRequest } from '../server/transformRequest'
1111import type { InternalResolveOptionsWithOverrideConditions } from '../plugins/resolve'
1212import { tryNodeResolve } from '../plugins/resolve'
13- import { genSourceMapUrl } from '../server/sourcemap'
1413import {
1514 ssrDynamicImportKey ,
1615 ssrExportAllKey ,
@@ -26,16 +25,6 @@ interface SSRContext {
2625
2726type SSRModule = Record < string , any >
2827
29- // eslint-disable-next-line @typescript-eslint/no-empty-function
30- const AsyncFunction = async function ( ) { } . constructor as typeof Function
31- let fnDeclarationLineCount = 0
32- {
33- const body = '/*code*/'
34- const source = new AsyncFunction ( 'a' , 'b' , body ) . toString ( )
35- fnDeclarationLineCount =
36- source . slice ( 0 , source . indexOf ( body ) ) . split ( '\n' ) . length - 1
37- }
38-
3928const pendingModules = new Map < string , Promise < SSRModule > > ( )
4029const pendingImports = new Map < string , string [ ] > ( )
4130
@@ -192,27 +181,17 @@ async function instantiateModule(
192181 }
193182 }
194183
195- let sourceMapSuffix = ''
196- if ( result . map ) {
197- const moduleSourceMap = Object . assign ( { } , result . map , {
198- // offset the first three lines of the module (function declaration and 'use strict')
199- mappings : ';' . repeat ( fnDeclarationLineCount + 1 ) + result . map . mappings ,
200- } )
201- sourceMapSuffix =
202- '\n//# sourceMappingURL=' + genSourceMapUrl ( moduleSourceMap )
203- }
204-
205184 try {
185+ // eslint-disable-next-line @typescript-eslint/no-empty-function
186+ const AsyncFunction = async function ( ) { } . constructor as typeof Function
206187 const initModule = new AsyncFunction (
207188 `global` ,
208189 ssrModuleExportsKey ,
209190 ssrImportMetaKey ,
210191 ssrImportKey ,
211192 ssrDynamicImportKey ,
212193 ssrExportAllKey ,
213- '"use strict";\n' +
214- result . code +
215- `\n//# sourceURL=${ mod . url } ${ sourceMapSuffix } ` ,
194+ '"use strict";' + result . code + `\n//# sourceURL=${ mod . url } ` ,
216195 )
217196 await initModule (
218197 context . global ,
0 commit comments