require is not defined
Closed this issue · 3 comments
on v5.0.1
error - ReferenceError: require is not defined in ES module scope, you can use import instead
ReferenceError: require is not defined in ES module scope, you can use import instead
at file:///xxxxx/node_modules/plyr-react/esm/index.mjs:80:21
Hey @tomtang1122
We are a pure ESM package for now, although we have another build-type (e.g. CJS) ready to use we are not exposing them in the package.json.
You can read more about it here
And if you tell us about your use case @chintan9 might consider providing our CSJ export for the next releases.
Hey @tomtang1122 ,
The reason you are getting the proxy in the first place cause for performance reasons we are not re-rendering the <Plyr />
component in the first place and mainly using it for the Static contents.
For attaching event listeners, and working directly with the plyr instance you can work with out custom hook usePlyr
instead
Here is the main proposal for the hook: #678
here are some examples that may guide you within your implementations