@@ -291,11 +291,7 @@ export default async function compile(file: string, compilerOptions: CompilerOpt
291291 * - 原始 cause stack
292292 * 这样 logger 至少能把问题落到本项目文件上,而不仅仅是 Node ESM 内部栈。
293293 */
294- function wrapImportError (
295- sourcePath : string ,
296- outputPath : string ,
297- cause : Error
298- ) : Error {
294+ function wrapImportError ( sourcePath : string , outputPath : string , cause : Error ) : Error {
299295 const suspicious = collectSuspiciousImports ( outputPath ) ;
300296 const parts : string [ ] = [
301297 `Failed to import compiled module` ,
@@ -363,9 +359,7 @@ export default async function compile(file: string, compilerOptions: CompilerOpt
363359 const content = await moduleGenerator ( ) ;
364360 fs . writeFileSync ( cache . outputPath , content ) ;
365361 try {
366- cache . resolve (
367- ( await import ( pathToFileURL ( cache . outputPath ) . href ) ) as Module
368- ) ;
362+ cache . resolve ( ( await import ( pathToFileURL ( cache . outputPath ) . href ) ) as Module ) ;
369363 } catch ( importErr ) {
370364 const ie = toError ( importErr ) ;
371365 const wrapped = wrapImportError ( modulePath , cache . outputPath , ie ) ;
@@ -457,9 +451,7 @@ export default async function compile(file: string, compilerOptions: CompilerOpt
457451 fs . writeFileSync ( result . resourceOutputPath , writable ) ;
458452 }
459453 try {
460- cache . resolve (
461- ( await import ( pathToFileURL ( cache . outputPath ) . href ) ) as Module
462- ) ;
454+ cache . resolve ( ( await import ( pathToFileURL ( cache . outputPath ) . href ) ) as Module ) ;
463455 } catch ( importErr ) {
464456 const ie = toError ( importErr ) ;
465457 throw wrapImportError ( resolvedPath , cache . outputPath , ie ) ;
0 commit comments