From d16a758d53256683fb089165fd970bae8d34fa96 Mon Sep 17 00:00:00 2001 From: Mats Johansen Date: Mon, 5 Feb 2024 17:08:35 +0100 Subject: [PATCH] fix(WIP: build): fix dist import --- vite.config.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index f67fdce2..2f16d9f2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -76,7 +76,7 @@ function afterBuild() :void { * Building somehow adds another @samply folder to the dist folder so this workaround is needed * to move the files to the root of the dist folder and delete the unnecessary folder */ - // restructureDirectory('./dist/@samply/'); + restructureDirectory('./dist/@samply/'); } /** @@ -118,16 +118,16 @@ function moveFile(oldFile: string, target: string): void { const interval = setInterval(() => { attempts++; if (fs.readFileSync(oldFile, 'utf-8').length > 0) { - // fs.renameSync(oldFile, target); - fs.copyFileSync(oldFile, target); + fs.renameSync(oldFile, target); + // fs.copyFileSync(oldFile, target); clearInterval(interval); } else if (attempts > 10) { clearInterval(interval); throw new Error('File not found'); } - // if(fs.readdirSync('./dist/@samply/').length === 0) { - // fs.rmSync('./dist/@samply/', { recursive: true, force: true }); - // } + if(fs.readdirSync('./dist/@samply/').length === 0) { + fs.rmSync('./dist/@samply/', { recursive: true, force: true }); + } }, 1000); }