From b6d0d5424191bae9d7df2acb52062d6fbf022380 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 17 Aug 2021 17:20:48 +0200 Subject: [PATCH] explicitly name snowpack build ouput dir, and remove it after build --- scripts/build.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index 164726b2..e97e5a1c 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -46,8 +46,9 @@ import flexbugsFixes from "postcss-flexbugs-fixes"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const projectDir = path.join(__dirname, "../"); +const snowpackOutPath = path.join(projectDir, "snowpack-build-output"); const cssSrcDir = path.join(projectDir, "src/platform/web/ui/css/"); -const snowpackConfig = await loadConfiguration({}, "snowpack.config.js"); +const snowpackConfig = await loadConfiguration({buildOptions: {out: snowpackOutPath}}, "snowpack.config.js"); const snowpackOutDir = snowpackConfig.buildOptions.out.substring(projectDir.length); const srcDir = path.join(projectDir, `${snowpackOutDir}/src/`); const isPathInSrcDir = path => path.startsWith(srcDir); @@ -112,6 +113,7 @@ async function build({modernOnly, overrideImports, overrideCss}) { await buildServiceWorker(swSource, version, globalHash, assets); await buildHtml(doc, version, baseConfig, globalHash, modernOnly, assets); + await removeDirIfExists(snowpackOutPath); console.log(`built hydrogen ${version} (${globalHash}) successfully with ${assets.size} files`); }