cookpete / react-player

A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
https://cookpete.github.io/react-player
MIT License
8.89k stars 1.12k forks source link

Move exports.key.default to last position #1828

Closed karlhorky closed 3 weeks ago

karlhorky commented 3 weeks ago

Addresses https://github.com/cookpete/react-player/issues/1613#issuecomment-2067993523


Comment content copied here:

Ah, seems like this 'react-player/file' import fails with a Default condition should be last one error message on compile time (Next.js) though 😬

Module not found: Default condition should be last one
  5 | // eslint-disable-next-line import/no-unresolved -- eslint-plugin-import doesn't understand `exports` in package.json yet https://github.com/import-js/eslint-plugin-import/issues/1810
> 6 | import ReactPlayer from 'react-player/file';
    | ^
  7 |
  8 | // ```
  9 |

https://nextjs.org/docs/messages/module-not-found

So maybe the "exports" config in package.json is misconfigured...

Eg. an example PR fixing such an error:

karlhorky commented 3 weeks ago

Glad to help, thanks for the review and merge!

I see that this was published in react-player@3.0.0-canary.4, thanks!

I can confirm that this is working for our Next.js project 👍