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

Make React compatible with ES Modules and Pika #15885

Closed
wants to merge 2 commits into from
Closed

Make React compatible with ES Modules and Pika #15885

wants to merge 2 commits into from

Conversation

thesoftwarephilosopher
Copy link

@thesoftwarephilosopher thesoftwarephilosopher commented Jun 14, 2019

See https://www.pika.dev/about/ for basic information about Pika.

When searching for React (https://www.pika.dev/search?q=react) in Pika's interface, it shows:

EXACT MATCH!
react
Package found! However, no ES "module" entrypoint was detected in its package.json manifest. If possible, explore the site for a more web-friendly alternative.

It looks like this commit in my PR is all that's needed, because React is fortunately already written using ES Module syntax.

See https://www.pika.dev/about/ for basic information about Pika.

When searching for React (https://www.pika.dev/search?q=react) in Pika's interface, it shows:

```
EXACT MATCH!
react      
Package found! However, no ES "module" entrypoint was detected in its package.json manifest. If possible, explore the site for a more web-friendly alternative.
```

It looks like this commit in my PR is all that's needed, because React is fortunately already written using ES Module syntax.
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@thesoftwarephilosopher
Copy link
Author

Ok I just signed the CA.

@sizebot
Copy link

sizebot commented Jun 14, 2019

No significant bundle size changes to report.

Generated by 🚫 dangerJS

@thesoftwarephilosopher
Copy link
Author

I added a second commit that makes the same exact change for ReactDOM. This PR should now be sufficient for most (all?) React users to now use Pika and ES Modules to load React.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@TrySound
Copy link
Contributor

This won't work. Sources are not ready for consuming.
This is the first step for this #15037
This is the second which is blocked til upgrade is merged.
#13321

@thesoftwarephilosopher
Copy link
Author

If it's true, that's a shame. Guess we'll have to wait to use React with Pika and use Preact@next in the meantime. Thanks @TrySound. Feel free to close this PR if it doesn't make sense in context of being merged after those two PRs are merged.

@jquense jquense closed this Jun 14, 2019
@thesoftwarephilosopher thesoftwarephilosopher deleted the patch-1 branch June 14, 2019 18:18
@TrySound
Copy link
Contributor

From what I see pika is able to provide own version of react for components.
Here react is imported from https://cdn.pika.dev/_/react/v16
https://storage.googleapis.com/pika-web-packages-02/rifm/0.9.1/dist-es2019/rifm.min.js

@thesoftwarephilosopher
Copy link
Author

thesoftwarephilosopher commented Jun 14, 2019

Oh perfect, how did I miss that! Thanks @TrySound this will help a ton :)

@FredKSchott
Copy link

For anyone else who finds this issue, we've added a note for how to use React with @pika/web
https://github.com/pikapkg/web#a-note-on-react

You can also search "react esm" on pika.dev to find a few different options for React & ReactDOM, published as ESM:
https://www.pika.dev/search?q=react%20esm

@jadjoubran
Copy link

Thanks @FredKSchott, though it seems that react-esm has been deleted

@FredKSchott
Copy link

Can you share a link to the deleted thing? I see react-esm & @reactesm both available:

https://www.npmjs.com/package/react-esm
https://www.npmjs.com/package/@reactesm/react

@jadjoubran
Copy link

jadjoubran commented Oct 7, 2019

Sorry I think I drew the wrong conclusion, however react-esm is not working on PikaCDN, it returns a 404:
https://cdn.pika.dev/react-esm/v16
Screenshot 2019-10-07 at 12 23 50

@FredKSchott
Copy link

Ah, that looks like a bug in the CDN resolver logic. Thanks for sharing, I'll get that fixed asap

@jadjoubran
Copy link

awesome thanks a lot!

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

Successfully merging this pull request may close these issues.

7 participants