Open saidelimam opened 2 months ago
It looks like it's related to CJS module export on a ESModule Vite project. Is there a chance to have an ESM package of react-player?
Which version of Vite are you using? I had the same issue with Vite v2, upgrading to v3 seems to have solved the issue for me.
Which version of Vite are you using? I had the same issue with Vite v2, upgrading to v3 seems to have solved the issue for me.
I'm on Vite version 5.0.11
I also had this problem come up recently (Vite v3).
Downgrading react-player from 2.14.1 to 2.13.0, the most recent previous version we had installed (upgrading seems to be the point where it stopped working) has resolved it.
Not sure if using 2.15.x will fix it, but don't have the time to test right now.
could you provide a Codesandbox reproduction online? that will make it easier to debug. thank you!
Downgrading from 2.16 to 2.13 worked with Vite for us with this error:
error during build:
Error: [commonjs--resolver] invalid import "import(
/ webpackIgnore: true /
${sdkUrl}
)". It cannot be statically analyzed. Variable dynamic imports must start with ./ and be limited to a specific directory. For example: import(./foo/${bar}.js
).
file: /Users/lydia/code/elka/csvite/node_modules/react-player/lib/players/Mux.js
try v3.0.0-canary.3, let me know if it works https://www.npmjs.com/package/react-player/v/3.0.0-canary.3 https://codesandbox.io/p/devbox/react-player-vite-6n78q7
here's the error:
Unexpected Application Error! Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
My Vite minify config: