Skip to content

Commit

Permalink
Fix duplicate output with multiple entry points (#251)
Browse files Browse the repository at this point in the history
On Windows the normalized paths in resolveId end up in POSIX format.
This cause rollup to treat the returned path as a new piece of content.
This in turn results in duplicate output for references across entry points.

Fixed by normalizing the path to use host OS separators before returning.
  • Loading branch information
antross committed Nov 20, 2020
1 parent 5ce7676 commit 6fb0e75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { parseTsConfig } from "./parse-tsconfig";
import { printDiagnostics } from "./print-diagnostics";
import { TSLIB, TSLIB_VIRTUAL, tslibSource, tslibVersion } from "./tslib";
import { blue, red, yellow, green } from "colors/safe";
import { relative, dirname, resolve as pathResolve } from "path";
import { relative, dirname, normalize as pathNormalize, resolve as pathResolve } from "path";
import { normalize } from "./normalize";
import { satisfies } from "semver";
import findCacheDir from "find-cache-dir";
Expand Down Expand Up @@ -166,7 +166,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
context.debug(() => `${blue("resolving")} '${importee}' imported by '${importer}'`);
context.debug(() => ` to '${resolved}'`);

return resolved;
return pathNormalize(resolved);
}

return;
Expand Down

0 comments on commit 6fb0e75

Please sign in to comment.