From fe5b5dcea6ad9db0a3db77bf577983ebcc8bde63 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 23 Nov 2021 12:02:52 +0000 Subject: [PATCH] fix(nitro): respect fs structure for traced files (#2107) --- packages/nitro/src/rollup/plugins/externals.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nitro/src/rollup/plugins/externals.ts b/packages/nitro/src/rollup/plugins/externals.ts index 7d668059b3..02ac9b0737 100644 --- a/packages/nitro/src/rollup/plugins/externals.ts +++ b/packages/nitro/src/rollup/plugins/externals.ts @@ -87,7 +87,7 @@ export function externals (opts: NodeExternalsOptions): Plugin { const writeFile = async (file) => { if (!await isFile(file)) { return } 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.replace(/^.*?node_modules[\\/](.*)$/, '$1')) await fsp.mkdir(dirname(dst), { recursive: true }) await fsp.copyFile(src, dst) }