From 72a4806ae2284fcdfe8547ade5aa3428fb85159b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Fri, 23 Aug 2024 09:08:57 +0300 Subject: [PATCH] fix: styles missing, error not shown --- package.json | 2 +- src/plugin.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9e99409..90d4e92 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "bugs": "https://github.com/AriPerkkio/vite-plugin-source-map-visualizer", "repository": "https://github.com/AriPerkkio/vite-plugin-source-map-visualizer", "scripts": { - "build": "rm -rf ./dist && tsc --project tsconfig.build.json", + "build": "rm -rf ./dist && tsc --project tsconfig.build.json && cp src/*.css dist", "test": "vitest --coverage", "typecheck": "tsc --noEmit" }, diff --git a/src/plugin.ts b/src/plugin.ts index d9cf029..ba9740e 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -50,9 +50,14 @@ export function sourcemapVisualizer(options?: Options): Plugin { }, async buildEnd() { - const filename = `${outDir}/${reportName}`; - const html = generateHTML(results, filename); - await fs.writeFile(filename, html, "utf8"); + try { + const filename = `${outDir}/${reportName}`; + const html = generateHTML(results, filename); + await fs.writeFile(filename, html, "utf8"); + } catch (error) { + console.error(error); + throw error; + } }, }; }