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.
This commit is contained in:
Tony Ross 2020-11-20 14:11:55 -06:00 committed by GitHub
parent 5ce7676ad0
commit 6fb0e75f53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<RPT2Options> = (options) =>
context.debug(() => `${blue("resolving")} '${importee}' imported by '${importer}'`);
context.debug(() => ` to '${resolved}'`);
return resolved;
return pathNormalize(resolved);
}
return;