From ce0db75c2963fbe221ef94cd62914557b41b3d61 Mon Sep 17 00:00:00 2001 From: Joshua Date: Thu, 22 Jun 2023 12:59:47 -0700 Subject: [PATCH] chore: Remove cache directory created by `ts-import`. --- src/lib/configuration-loader.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/configuration-loader.ts b/src/lib/configuration-loader.ts index 7543224..70c9f4e 100644 --- a/src/lib/configuration-loader.ts +++ b/src/lib/configuration-loader.ts @@ -147,15 +147,17 @@ async function withTsImport(filePath: string) { // Slower, but allows files to be considered as part of larger TypeScript // programs, which should allow path mappings to work. mode: tsImport.LoadMode.Compile, + // N.B. Even with this set to false, ts-import still seems to create (and + // leave behind) a .cache directory. useCache: false }); // Clean-up the cache directory left behind by ts-import. - // try { - // await fs.remove(path.join(path.dirname(filePath), '.cache')); - // } catch (err: any) { - // log.error(log.prefix('ts-import'), 'Error removing cache directory:', err); - // } + try { + await fs.remove(path.join(path.dirname(filePath), '.cache')); + } catch (err: any) { + log.error(log.prefix('ts-import'), 'Error removing cache directory:', err); + } return result?.default || result; }