Skip to content

Commit

Permalink
fix(externals): normalize output paths to flat strcture
Browse files Browse the repository at this point in the history
resolves #106
  • Loading branch information
pi0 committed Apr 19, 2022
1 parent 362e5bd commit a7f451f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rollup/plugins/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ 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.replace(/^.*?node_modules[\\/](.*)$/, '$1'))
const { pkgName, subpath } = parseNodeModulePath(file)
const dst = resolve(opts.outDir, `node_modules/${pkgName}/${subpath}`)
await fsp.mkdir(dirname(dst), { recursive: true })
await fsp.copyFile(src, dst)
}
Expand Down

0 comments on commit a7f451f

Please sign in to comment.