fix(plugin): don't prefix absolute win paths #2788
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Compilation fails on Windows in certain cases when using the GraphQL plugin because absolute paths are prefixed with
./
.Issue Number: #2661
What is the new behavior?
Don't prefix absolute paths on Windows with
./
.Does this PR introduce a breaking change?
Other information
I think this is a temporary solution at best. I'm not sure the
posix
version ofpath
methods should be being used for all the logic in the plugin, since things likeposix.relative()
do not behave properly with windows paths. I could maybe create another pull request to switch to the non-posix path methods, but not sure if I'm missing an important reason it's in use.I also wanted to add a test but it's tricky:
This test fails if run on Linux, since
path.isAbsolute('C:/...')
only returnstrue
when run on Windows. I didn't want to complicate things by using Jest to mock path functions. Something like jest-os-detection allows specifying whether a test should be skipped/run depending on the OS, but this is only very useful if CI also runs the test suite on Windows, and I didn't want to make too many changes for this pull request.