Does not work correctly on Windows
This package uses hardcoded forward slashes with plain string matching, mixed with path.resolve uses that will return backslashes on Windows, thus imports do not resolve correctly.
It works correctly if ran via WSL on Windows.
Recommend adding this to the README?
Windows can cope with forward slashes. The only place where that doesn't work is in a terminal, because forward slashes are used a terminal command parameters.
And even a mix style (foward and back slash) shouldn't cause problems. What exactly are you seeing?
If I had to guess, it's this issue that I'm seeing as well.
public static fromFile = (source: string, target: string, packageRoot: string,
replacements?: Map<RegExp, string>): PackageSource => {
// Construct a package name for lookup from the given paths.
if (!source.startsWith(packageRoot)) {
throw new Error("The full path must specify a file within the given package root.");
}
The source string and package root string might not have consistent slash direction on windows, so the startsWith check always fails for me. Haven't been able to verify, but that's what I'm suspicious of right now.
Oh, ok, that needs investigation, but I recommend to use forward slashes always.