silvermine / videojs-chromecast

MIT License
147 stars 74 forks source link

Issue with @silvermine/videojs-chromecast #131

Closed nimeshjohri-viewlift closed 1 year ago

nimeshjohri-viewlift commented 1 year ago

Current version I am using: v1.3.3

Issue:

Failed to compile.

./node_modules/@silvermine/videojs-chromecast/src/js/chromecast/ChromecastSessionManager.js SyntaxError: /node_modules/@silvermine/videojs-chromecast/src/js/chromecast/ChromecastSessionManager.js: Support for the experimental syntax 'classProperties' isn't currently enabled (49:24):

47 | } 48 |

49 | static hasConnected = false; | ^ 50 | 51 | /* 52 | Add event listeners for events triggered on the current CastContext.

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.

Information:

Since past 24 hours, I am getting this error while compiling my react application. It was working fine earlier. I have all the required config in .babelrc and webpack.config.js, but still its giving error. Also, I tried upgrading the package to v1.3.4, but still the same issue.

.babelrc { "presets": ["@babel/preset-env", "@babel/preset-react"], "plugins": [ "@babel/plugin-transform-runtime", "@babel/plugin-syntax-dynamic-import", "@babel/plugin-proposal-class-properties", "@loadable/babel-plugin", ] }

yokuze commented 1 year ago

@nimeshjohri-viewlift Sorry, it's not possible to say what's wrong without a complete example of your setup. At a glance, the Babel config you're using looks correct.

I can tell you that this project gets transpiled as part of its CI build process, and that it transpiles correctly with no error. Also, I use this plugin in a closed-source project that includes the @babel/plugin-proposal-class-properties in its Babel config and it also transpiles without error. So, the issue is almost certainly in your project's configuration and not in this repo. You could start by comparing this repo's configuration with your own.

If you can't get past the issue and need a workaround, you could configure your bundler to alias @silvermine/videojs-chromecast to node_modules/@silvermine/videojs-chromecast/dist/silvermine-videojs-chromecast.min.js, which is the built/transpiled version of this plugin and does not require transpiling ES6+ syntax.

If you're able to create a MRE that demonstrates an issue in this project and link to it here, we can reopen the issue.

Examples of MRE's that we've made on other issues:

https://github.com/videojs/video.js/issues/4765 https://github.com/videojs/http-streaming/issues/172

Thanks!

BjornGameDev commented 1 year ago

Same issue if you try to compile with Angular. Why isn't this static variable just moved to constructor as this.hasConnected = false; instead of requiring experimental options for the bundler.