diff --git a/code/builders/builder-vite/src/plugins/external-globals-plugin.ts b/code/builders/builder-vite/src/plugins/external-globals-plugin.ts index aab1bd72c694..242fb98ff3dc 100644 --- a/code/builders/builder-vite/src/plugins/external-globals-plugin.ts +++ b/code/builders/builder-vite/src/plugins/external-globals-plugin.ts @@ -52,7 +52,10 @@ export async function externalGlobalsPlugin(externals: Record): } const newAlias = mergeAlias([], config.resolve?.alias) as Alias[]; - const cachePath = pkg.cache('sb-vite-plugin-externals', { create: true })!; + const cachePath = + pkg.cache('sb-vite-plugin-externals', { create: true }) ?? + join(process.cwd(), 'node_modules', '.cache', 'sb-vite-plugin-externals'); + await Promise.all( (Object.keys(externals) as Array).map(async (externalKey) => { const externalCachePath = join(cachePath, `${externalKey}.js`);