Skip to content
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

Issues with react-packager running on Windows #133

Closed
joewood opened this issue Mar 9, 2015 · 7 comments
Closed

Issues with react-packager running on Windows #133

joewood opened this issue Mar 9, 2015 · 7 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@joewood
Copy link

joewood commented Mar 9, 2015

I'm trying to run the react-packager on Windows, to provide the bundle running on an iOS device. I'm hitting some issues with the output of the packager when running on Windows vs. OSX. The Movies app on the device complains that the dependencies are not resolved and fails to load.

I ran the packager on both platforms and compared the output via curl to do a diff. It's not that easy to compare this, as the packager doesn't seem to respect the same order on each platform. Inspecting the files a bit more closely I can spot a problem with path names and escaping out the path separator.

For example, the require statements are not escaped out:

'use strict';

var React = require('react-native\react-native');

But the dependency parameter array does escape out the path separator, see react-native\\react-native below:

module.exports = MovieCell;
});
__d('react-native\Examples\Movies\getStyleFromScore',["react-native\\react-native"],function(global, require, requireDynamic, requireLazy, module, exports) {  /**
 * Copyright 2004-present Facebook. All Rights Reserved.
 * @flow
 */
'use strict';

I'm not sure if this is the problem, but it looks like it's tripping up the dependency resolver.

@vjeux
Copy link
Contributor

vjeux commented Mar 9, 2015

cc @amasad. Note that we've never tested on windows any of the stack, so it's likely that there are more problems down the road.

@joewood
Copy link
Author

joewood commented Mar 9, 2015

It may be simpler here to just regex replace backslash paths with forward slash, as either works in the node environment on Windows. I'll give that a try to see if I can progress this further.

Any reason why you didn't opt to just use browserify or webpack for the packager? This would open the door to other transforms and plugins, workflows around static and dynamic packages etc...

@vjeux
Copy link
Contributor

vjeux commented Mar 9, 2015

Any reason why you didn't opt to just use browserify or webpack for the packager? This would open the door to other transforms and plugins, workflows around static and dynamic packages etc...

We've tried but they are orders of magnitude too slow for codebases as big as Facebook. We unfortunately had to roll out with our own in order to have sub-second incremental build time.

That said, we want to play nice with those tools so that we can interoperate. We really hope that by open sourcing react-native, people outside of Facebook will help us there.

@joewood
Copy link
Author

joewood commented Mar 11, 2015

I fixed the issues with the output above by escaping out the paths in haste. That fixed that issue, but the packager doesn't seem to be able to locate the react-native/addons package. It also looks like watchman doesn't work on Windows (at least not properly), so this maybe a non-starter. I may be better off re-implementing the packager server around browserify and use contrib_watch instead.

@joewood
Copy link
Author

joewood commented Mar 12, 2015

I'm trying to integrate the browserify packager into the workflow, but it looks like the react-native packager doesn't use the standard node.js like search algorithm. Instead it seems to recurse down into the directories. This makes building anything with react-native more difficult. Is this a necessary part of the design?

@joewood
Copy link
Author

joewood commented Mar 12, 2015

So it looks like I need to run the packager to do the packaging stage using @providesModule before I use it in browserify. Is there a special URL to bundle up the library only (without a main entry point). When I run:

curl http://localhost:8081/Libraries/react-native/react-native.bundle -o react-native.js

The packager complains that there's no entry point.

@brentvatne
Copy link
Collaborator

@joewood - feel free to re-open if this is still a problem, it looks like you've figured it out in #278

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants