Skip to content

Commit

Permalink
Add forced dependency re-optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpreiss committed Jan 29, 2024
1 parent c76416f commit 98e369f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions getSafelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ export async function getSafelist(configPath, processFile) {
watcher
.subscribe(resolve(process.cwd(), './src'), async (err, events) => {
for (const { path } of events) safelist = await readSafelist(path);
// shitty way to restart vite server?
const viteConfigContent = await fs.readFile(resolve(process.cwd(), './postcss.config.js'), {
encoding: 'utf8'
});
await fs.writeFile(resolve(process.cwd(), './postcss.config.js'), viteConfigContent);
// Force dependency re-optimization by removing the node_modules/.vite folder
await fs.rm(
resolve(process.cwd(), './node_modules/.vite'),
{ recursive: true, force: true },
(err) => {
if (err) {
throw err;
}
console.log(`${resolve(process.cwd(), './node_modules/.vite')} is deleted!`);
}
);
})
.then((w) => (global.watcher = w));
}
Expand Down

0 comments on commit 98e369f

Please sign in to comment.