From ff5b66e02c7c93b1352196a851758142c7df7031 Mon Sep 17 00:00:00 2001 From: Tony Ross <785009+antross@users.noreply.github.com> Date: Wed, 11 Nov 2020 17:09:57 -0600 Subject: [PATCH] Fix duplicate output with multiple entry points 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 9749d4e1..f7222a58 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;