react-player icon indicating copy to clipboard operation
react-player copied to clipboard

React-player error when minified

Open saidelimam opened this issue 1 year ago • 10 comments

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:

minify: 'terser',
terserOptions: {
compress: {
    drop_console: isProduction && !isPreview,
    drop_debugger: true, 
    passes: 3, 
    reduce_funcs: true,
    reduce_vars: true, 
},
format: {
    comments: false, 
    wrap_iife: true,
},
mangle: {
    properties: {
	    regex: /^_/, // 
    },
},
ecma: 2020,
module: true,
toplevel: true,
safari10: true,
},

saidelimam avatar Feb 23 '24 11:02 saidelimam

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?

saidelimam avatar Feb 24 '24 23:02 saidelimam

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.

thdebay avatar Feb 27 '24 09:02 thdebay

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

saidelimam avatar Feb 27 '24 20:02 saidelimam

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.

floodofstatic avatar Mar 06 '24 15:03 floodofstatic

could you provide a Codesandbox reproduction online? that will make it easier to debug. thank you!

luwes avatar Mar 06 '24 15:03 luwes

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

LydiaF avatar Apr 13 '24 15:04 LydiaF

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

luwes avatar Apr 20 '24 19:04 luwes

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

Upgrading react-player to v3.0.0-canary.3 fixed the issue for me. I'm using Vite v3.1

bev avatar Aug 19 '24 00:08 bev