From 6fb0e75f5328666dca8ff7b11bc956096351a3eb Mon Sep 17 00:00:00 2001 From: Tony Ross <785009+antross@users.noreply.github.com> Date: Fri, 20 Nov 2020 14:11:55 -0600 Subject: [PATCH] Fix duplicate output with multiple entry points (#251) 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. --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9749d4e..f7222a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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"; @@ -166,7 +166,7 @@ const typescript: PluginImpl = (options) => context.debug(() => `${blue("resolving")} '${importee}' imported by '${importer}'`); context.debug(() => ` to '${resolved}'`); - return resolved; + return pathNormalize(resolved); } return;