We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8b77695 commit 2c2a86bCopy full SHA for 2c2a86b
packages/vite/src/node/config.ts
@@ -887,9 +887,12 @@ export async function loadConfigFromFile(
887
// bundle the config file w/ ts transforms first, write it to disk,
888
// load it with native Node ESM, then delete the file.
889
fs.writeFileSync(resolvedPath + '.mjs', bundled.code)
890
- userConfig = (await dynamicImport(`${fileUrl}.mjs?t=${Date.now()}`))
891
- .default
892
- fs.unlinkSync(resolvedPath + '.mjs')
+ try {
+ userConfig = (await dynamicImport(`${fileUrl}.mjs?t=${Date.now()}`))
+ .default
893
+ } finally {
894
+ fs.unlinkSync(resolvedPath + '.mjs')
895
+ }
896
debug(`TS + native esm config loaded in ${getTime()}`, fileUrl)
897
} else {
898
// using Function to avoid this from being compiled away by TS/Rollup
0 commit comments