Skip to content

Commit

Permalink
fix(WIP: build): fix dist import
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsJohansen87 committed Feb 5, 2024
1 parent 774dbec commit d16a758
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/');
}

/**
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit d16a758

Please sign in to comment.