fix(nitro): skip copying symlinks and directories (#1510)

This commit is contained in:
Anthony Fu 2021-11-02 20:26:43 +08:00 committed by GitHub
parent eb67eb919e
commit aba2d224d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,10 @@ export function externals (opts: NodeExternalsOptions): Plugin {
} }
const writeFile = async (file) => { const writeFile = async (file) => {
// Skip symlinks that are included in fileList
if (await fse.stat(file).then(i => i.isDirectory())) {
return
}
const src = resolve(opts.traceOptions.base, file) const src = resolve(opts.traceOptions.base, file)
const dst = resolve(opts.outDir, 'node_modules', file.split('node_modules/').pop()) const dst = resolve(opts.outDir, 'node_modules', file.split('node_modules/').pop())
await fse.mkdirp(dirname(dst)) await fse.mkdirp(dirname(dst))