systemjs / builder

SystemJS build tool
MIT License
465 stars 122 forks source link

Fix incorrect source path normalization, when the path is a file URL on a non-Windows system #837

Closed thomas-darling closed 6 years ago

thomas-darling commented 6 years ago

The utility function fromFileURL seem to have an inconsistent behavior, where it removes the leading / from the path when running on Windows, but not when running on a non-Windows system.

This inconsistency caused the issue reported in https://github.com/jspm/jspm-cli/issues/2361#issuecomment-350192381, where the source paths were only made relative to the outPath when building on a Windows system, thus resulting in full file system paths in source maps built on non-Windows systems.

This pull request fixes this bug.

Note that this fix is specifically to restore the correct behavior for source paths - it makes no attempt to fix the inconsistent behavior in the fromFileURL function, as the consequences of doing so are unclear.

guybedford commented 6 years ago

Thanks for this an apologies for the delay here.