From 678a689500318761112f85f54da8fa0cc02a1692 Mon Sep 17 00:00:00 2001 From: Dimitris Klouvas Date: Mon, 30 Oct 2023 14:11:39 +0200 Subject: [PATCH] fix(shared): Fix error on post-build script with existing subpath barel directories --- scripts/subpath-workaround.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/subpath-workaround.mjs b/scripts/subpath-workaround.mjs index 8c3c507256a..d75adac469b 100644 --- a/scripts/subpath-workaround.mjs +++ b/scripts/subpath-workaround.mjs @@ -41,7 +41,10 @@ async function run() { // Create directories for each subpath name using the pkgJsonPlaceholder subpathHelperFile.subpathNames.forEach(name => { - fs.mkdirSync(new URL(`../packages/${pkgName}/${name}`, import.meta.url)); + const directoryURL = new URL(`../packages/${pkgName}/${name}`, import.meta.url); + if (!fs.existsSync(directoryURL)) { + fs.mkdirSync(directoryURL); + } writeJSON(`../packages/${pkgName}/${name}/package.json`, pkgJsonPlaceholder(name)); });