Skip to content

Commit

Permalink
fix: correct filename for single file /w preserveModules
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed May 17, 2020
1 parent ca60056 commit 837f9ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ export default (options: Options = {}): Plugin => {
}

const root = entries.find(e => e.isEntry) ?? entries[0];
const name = opts.file ? path.basename(opts.file, path.extname(opts.file)) : root.name;
const name = opts.file
? path.basename(opts.file, path.extname(opts.file))
: preserveModules
? path.basename(root.fileName, path.extname(root.fileName))
: root.name;
const ids = entries.reduce<string[]>((acc, e) => [...acc, ...getImports(e)], []);
if (ids.length !== 0) idsMap.set(name, ids);

Expand Down

0 comments on commit 837f9ed

Please sign in to comment.