-
Notifications
You must be signed in to change notification settings - Fork 58
fix: isFilePath not working on windows #6
fix: isFilePath not working on windows #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good change. It's not entirely clear what the expectation of isFilePath is - perhaps using path.parse and processing the output would be easier to understand.
My issue seems to stem from the fact that I have absolute paths on windows. I added the following outside of if(isFilePath(updatedId)) and it resolves my issue:
|
* Don't confuse modules with similar names * More bugfixes for similar module names * Even more improvements for similar module names
@Rich-Harris Could you take a look? Seems like without a fix for this (I’m not sure if it’s the right fix) we can’t build React on Windows: facebook/react#9350 (comment). |
…lba/rollup-plugin-alias into zacharygolba-fix-windows-file-paths
So, I created a dummy PR (#16) to try to coax Appveyor into testing this branch, and some tests are failing — possibly unrelated to #3. I haven't yet had a chance to investigate, will try and take a look soon. Appveyor output is here if anyone is interested. |
Nice! Is this a matter of tests needing an update or is there an issue with the implementation? After a quick glance at the Appveyor output, it almost seems like this plugin assumes the existence of rollup-plugin-node-resolve. Here is a link to an example of the resulting regex on windows. I added the Let me know if there is anything I can do to help. |
I assume it's an issue(s) with the implementation. Not entirely sure, though — if anyone can check out the |
@Rich-Harris I got this working on macOS 10.12.4 as well as Windows 10 (running in a vm). I changed the implementation to first convert windows paths into the posix equivalent and then further parsing/updates to the ids use the If this looks promising, I can do some cleanup on the implementation and tests. |
Here is a diff against the |
@zacharygolba thank you! looks like green lights all round. I'll cut a new release now so that we can finally close #3, I don't think there's any great need for further cleanup but totally up to you 🍻 |
@Rich-Harris Anytime! I'm happy to help out. 😃 |
Closes #3
Uses
path.sep
to generate aRegExp
that works for both Windows and UNIX based systems.Windows:
/^\.?\\/
Linux/OSX:
/^\.?\//