-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Packager] Steps to get packager working on Windows #468
Comments
👍 |
Thanks for the write up. Happy to take PR, but it'd be great if we split them into multiple PRs. |
You have to kick this off with the initial build and deploy to the device using a Mac. But once the app is on there the packager can be running on the PC. I'll put together some PRs, maybe clean up the code a little. |
Summary: Another Pull Request implementing the changes in issue facebook#468 - Enabled Packager to run on Windows This change relates to the blacklist fixes. It includes the path conversion for blacklist and changes to the default watched directory. It has no impact on Mac OSX. Closes facebook#893 Github Author: Joe Wood <joewood> Test Plan: Imported from GitHub, without a `Test Plan:` line.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
I believe the packager works on Windows now? If not, let me know and I'll reopen |
I made a few changes to the packager so that it runs on Windows. So, I can now develop react-native apps running from the packager server on Windows (after an initial deploy from OSX). Rather than sending a PR, I've listed the changes below:
FileWatcher
Do not install watchman (or uninstall it). The
FileWatcher
uses sane which delegates tonodeWatcher
if watchman isn't installed. Note that watchman doesn't work on windows. Note, also I had to increase theMAX_WAIT_TIME
in FileWatcher/index.js to avoid that timeout error (I guess nodeWatcher is slower on start-up).Blacklist
The
blacklistRE
is a regular expression list of file paths that should be ignored by the packager. The regex uses forward slashes in the file paths. The discovered file paths returned by node have backslash on Windows, so the test was failing - essentially ignoring the blacklist. To fix this I added a step in theescapeRegExp
function in packager/blacklist.js to substitute all\
s withpath.sep
:I also added
".git"
to the shared blacklist, as the nodeWatcher doesn't seem to automatically ignore these directories.Module Names Correct Path
In packager/react-packager/src/DependencyResolver/haste/index.js I modified the code to ensure that module names that contain the backslash were replaced with a forward slash. I did this with a local in-place regex
replace
in the expression:The same change also needs to be applied for the
runModule
in the finally emittedrequire
. This is in the packager/react-packager/src/Packager/Package.js file:Default Project Root
Last minor change is for when the packager is run from node_modules. There's some code in packager.js that tests for this and sets the project root to
../../
. The file path check uses\
, so I use regex to use either path separator, packager.js:50:The text was updated successfully, but these errors were encountered: