From 1d71aec752b5122512e13044d3fe47092d6e92a4 Mon Sep 17 00:00:00 2001 From: D Date: Sat, 4 Nov 2023 23:16:59 +0000 Subject: [PATCH] fix(insight): use relative path (#5399) --- packages/qwik-labs/src-vite/insights/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/qwik-labs/src-vite/insights/index.ts b/packages/qwik-labs/src-vite/insights/index.ts index 7176a85a372..ef6c8f03046 100644 --- a/packages/qwik-labs/src-vite/insights/index.ts +++ b/packages/qwik-labs/src-vite/insights/index.ts @@ -40,12 +40,13 @@ export async function qwikInsights(qwikInsightsOpts: { } catch (e) { logWarn('fail to fetch manifest from Insights DB'); } - if (!existsSync(join(process.cwd(), outDir))) { - mkdirSync(join(process.cwd(), outDir), { recursive: true }); + const cwdRelativePath = join(viteConfig.root || '.', outDir); + const cwdRelativePathJson = join(cwdRelativePath, 'q-insights.json'); + if (!existsSync(join(process.cwd(), cwdRelativePath))) { + mkdirSync(join(process.cwd(), cwdRelativePath), { recursive: true }); } - const cwdRelativePath = join(viteConfig.root || '.', outDir, 'q-insights.json'); - log('Fetched latest Qwik Insight data into: ' + cwdRelativePath); - await writeFile(join(process.cwd(), cwdRelativePath), JSON.stringify(qManifest)); + log('Fetched latest Qwik Insight data into: ' + cwdRelativePathJson); + await writeFile(join(process.cwd(), cwdRelativePathJson), JSON.stringify(qManifest)); } }, closeBundle: async () => {