File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1020,12 +1020,14 @@ async function loadConfigFromBundledFile(
1020
1020
// with --experimental-loader themselves, we have to do a hack here:
1021
1021
// write it to disk, load it with native Node ESM, then delete the file.
1022
1022
if ( isESM ) {
1023
- const fileUrl = pathToFileURL ( fileName )
1024
- fs . writeFileSync ( fileName + '.mjs' , bundledCode )
1023
+ const fileBase = `${ fileName } .timestamp-${ Date . now ( ) } `
1024
+ const fileNameTmp = `${ fileBase } .mjs`
1025
+ const fileUrl = `${ pathToFileURL ( fileBase ) } .mjs`
1026
+ fs . writeFileSync ( fileNameTmp , bundledCode )
1025
1027
try {
1026
- return ( await dynamicImport ( ` ${ fileUrl } .mjs?t= ${ Date . now ( ) } ` ) ) . default
1028
+ return ( await dynamicImport ( fileUrl ) ) . default
1027
1029
} finally {
1028
- fs . unlinkSync ( fileName + '.mjs' )
1030
+ fs . unlinkSync ( fileNameTmp )
1029
1031
}
1030
1032
}
1031
1033
// for cjs, we can register a custom loader via `_require.extensions`
You can’t perform that action at this time.
0 commit comments