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

extract to '@providesModule' to a plugin and maybe open source it ? #154

Closed
mitermayer opened this issue Jun 30, 2016 · 4 comments
Closed

Comments

@mitermayer
Copy link

I really like the '@providesModule' functionality that has been used all over facebook open source projects, I really find it super useful. was wondering how much work would be involved in extracting it out from here in its own project and open source it ? :D

@mitermayer
Copy link
Author

just found it on https://github.com/facebook/commoner

@sophiebits
Copy link
Contributor

commoner is an older project which I'm not sure we use at all any more. Right now I believe we have three open source solutions for handling these:

  1. fbjs rewrite-requires is intended to be used with copying all built files to a flat dir and requiring ./X instead of X. We use this for building projects like react and draft-js for npm.
  2. The RN packager supports @providesModule natively but isn't designed to be general purpose.
  3. jest-haste-map (part of jest) can shim the require function in node to implement this behavior at runtime. Despite its name, this can be used outside of jest and is not tied to testing.

We don't support any of these for external users though. We might even change our OSS projects to not use @providesModule at all over time since it's always an interop hassle.

@mitermayer
Copy link
Author

mitermayer commented Jun 30, 2016

Thanks for the answer! I have to admit I like the idea of flat modules somehow since dealing with '../../' on imports is very painful

@vko-online
Copy link

+1 Up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants