Can't seem to get the package working and import errors for v5
maxhelsel opened this issue · comments
I've been using the regular Plyr package and have it working. Was gonna give this a try, but I can't seem to get off the ground here.
Simply trying to import the following according to docs:
import Plyr from 'plyr-react'
import 'plyr-react/dist/plyr.css'
leads to this:
ERROR in ./src/components/main/views/videos/player/VideoPlayer.js 7:0-30
Module not found: Error: Can't resolve 'plyr-react' in [......my pathname......]
ERROR in ./src/components/main/views/videos/player/VideoPlayer.js 8:0-29
Module not found: Error: Package path ./plyr.css is not exported from package ..../node_modules/plyr-react
The packages are installed and present in node modules folder. I feel like this might be some webpack black magic stuff??
Not sure what the deal is - any thoughts or solutions are greatly appreciated!
Also, what is the benefit to using this package, "plyr-react" over the regular "plyr" package? I'm just trying to figure out if continuing with this is worth the extra effort considering I have "plyr" working already.
@maxhelsel Can you use v5.0.1 from now on?
Let me know if have any issue right now.
On my side, v5.0.1 too, importing plyr-react works well, however importing the CSS file import "plyr-react/plyr.css";
is broken:
Compiled with problems:
ERROR in ./src/components/ContentViewer/component.tsx 22:0-29
Module not found: Error: Package path ./plyr.css is not exported from package /Users/ntag/Documents/ntag/flocon/flocon/webapp/node_modules/plyr-react (see exports field in /Users/ntag/Documents/ntag/flocon/flocon/webapp/node_modules/plyr-react/package.json)
It's just a CRA TypeScript app. Thanks!
Hum actually even if the import of plyr-react
is working, when you try to use the <Plyr
component, at runtime a crash happens because of this line: https://github.com/chintan9/plyr-react/blob/master/dist/esm/index.js#L87
I guess there is an issue with the rollup config? Maybe https://stackoverflow.com/questions/67811412/rollup-react-17-with-new-jsx-transform-react-is-not-defined
It seems there was a problem in tsx section for ESM modules
could anyone test the latest version
npx degit https://github.com/chintan9/plyr-react
cd plyr-react
npm install
npm run build
cd dist
npm pack
cd <your-project>
npm install <path to `plyr-react-5.0.0.tar.gz`>
# or
# yarn install <path to `plyr-react-5.0.0.tar.gz`>
I'm currently having the same issues for 5.0.1 where "React is not defined".
@realamirhe I just tested and it works! Both importing and using plyr-react
and importing the css file in my CRA TypeScript project. I think you can publish a 5.0.2 version. Thanks a lot!
@chintan9 could you republish the package for version 5.0.2
npm build
np publish 5.0.2 --branch master --contents dist
Is this issue resolved? I am facing the same issue using version 5.0.1
. I think there is no new release yet. Or is there any workaround for now
Is this issue resolved? I am facing the same issue using
version 5.0.1
. I think there is no new release yet. Or is there any workaround for now
I downgraded back to v4 until they push a new release.
We are having issue with v5.
Please use v4 until further notice
v5.1.0 was published
can confirm. v5.1.0 works 🎉