Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Demonstrate/document/support NPM to share React components. #3

Open
jordwalke opened this issue Aug 25, 2013 · 0 comments
Open

Demonstrate/document/support NPM to share React components. #3

jordwalke opened this issue Aug 25, 2013 · 0 comments

Comments

@jordwalke
Copy link
Contributor

Right now, sharing of React components through NPM should work. However, there's still some questions about how components would render images with paths that refer to resources in their own npm module folder. They may be relative to their JS file, but JS files are packaged (as they should be) into a monolithic build - the contents' relative image urls would be incorrect.

I'll experiment with the ability to use commonJS path resolution for image URLs. That way npm projects can also expose their own resources (useful when mixing in/composing components).

<img src={require('yourProject/images/logo.png')} />
<img src={require('./insideMyProject/logo.png')} />

The reason why I suggest require() is because we can easily support it in react-page, but also because any React component deployed to to npm could work outside of react-page. Any node environment can implement custom handlers for image extensions such that it behaves exactly like react-page.

I'm looking for any solution satisfying:

  1. Easily share components with anyone through NPM.
  2. Relative image urls work in familiar way (commonJS require a strong candidate).
  3. A reasonable solution can/should easily be implementable outside of react-page.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant