Skip to content

Commit

Permalink
fix(nitro): fix EBUSY error on windows (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Aug 9, 2021
1 parent 4f118b6 commit 5d79b2f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/rollup/plugins/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,20 @@ export function externals (opts: NodeExternalsOptions): Plugin {
}
}

await Promise.all(tracedFiles.map(async (file) => {
const writeFile = async (file) => {
const src = resolve(opts.traceOptions.base, file)
const dst = resolve(opts.outDir, 'node_modules', file.split('node_modules/').pop())
await mkdirp(dirname(dst))
await copyFile(src, dst)
}))
}
if (process.platform === 'win32') {
// Workaround for EBUSY on windows (#424)
for (const file of tracedFiles) {
await writeFile(file)
}
} else {
await Promise.all(tracedFiles.map(writeFile))
}
}
}
}
Expand Down

0 comments on commit 5d79b2f

Please sign in to comment.