-
Notifications
You must be signed in to change notification settings - Fork 793
Support for webpack? #600
Comments
I think this was the issue behind videojs/mux.js#53. That was fixed in mux.js >= 2.0.1, which you should use if you build this project yourself (and in our next release when that happens). Do you see the same error if you build contrib-hls yourself? |
+1 Going to try building contrib-hls myself now. |
Eh - no luck... @hanfeisun did you find a solution? |
@samward1985 No, it doesn't work under Webpack now.. So I am still using |
Hello all!) videojs-contrib-hls v2.2.0 |
I think contrib-hls 2.2.0 won't require any aliases anymore. Though, unfortunately, that version also requires videojs 5.10.1 and up. |
@gkatsev i have videojs v5.10.2, but webworkify breaks webpack build because of |
If webworkify is the only problem, we should consider swapping it out for another module with similar functionality that works in both webpack and browserify. |
There seems to be a webworkify-webpack module which may work for webpack but it doesnt work for browserify. Someone should write a module that works for both. |
After some thought and some discussion in babel's chatroom, it seems like the correct solution is to not rely on a packer transform or loader to the web worker inline but rather do it as a separate source transform. I saw https://github.com/mohayonao/inline-worker which may help but also maybe there's some babel plugin that allows us to do this. |
I was having the same issue with webpack and contrib-hls. I was able to get it working by aliasing webworkify to webworkify-webpack in my webpack config like so: // ...
resolve: {
alias: {
webworkify$: 'webworkify-webpack'
}
},
// ... The strange caveat is that I need point to version 1.0.6 in my package.json instead of the current version (which is 1.1ish). Got that little tidbit from a separate issue here Hope this helps anyone! |
I am facing the same and added below code too. resolve: { |
this is giving the error of |
If anyone else encounters this issue again (or a similar one) and wants to use videojs-contrib-hls with Webpack:
Just add resolve: {
alias: {
webworkify: 'webworkify-webpack-dropin',
},
} It's been tested on videojs-contrib-hls v3.7.0-beta3 and video.js 5.12.6. |
Anyone know of a babel webworkify plugin? If we can inline the webworker at that point, we can easily support both webpack and browserify without extra work on the user's part |
@Ambroos also, thanks for making the dropin replacement package, seems like it'll make things a lot simpler in the meantime. |
@Ambroos I've tried your solution and I'm getting an error thrown here in webworkify-webpack-dropin:
I've made sure that I'm not using eval sourcemaps. |
@vpowers Could you show me your webpack config? I can't really think of any reason for this error to appear. |
@Ambroos Here is my nwb.config.js. Webpack configuration is passed in:
Here is the line in virtual-source-buffer.js (es5) from videojs-contrib-media-sources that executes webworkify-webpack-dropin:
|
I've attempted to isolate the issue by creating a small app using videojs-contrib-hls and bundling with webpack and @Ambroos 's solution does work. I had been testing this within a larger react app that uses nwb so somethings going on there. I'll provide an update if I can figure out the issue. |
@dbryand My react app is using nwb for bundling instead of plain webpack. (nwb uses webpack under the hood). This seems to be the difference. Are you just using webpack? |
Yes, a home-rolled webpack config. |
I've created two small applications. One using webpack and video.js with hls plugin and a react app using nwb (https://github.com/insin/nwb) and video.js with hls plugin. Both of them are swapping out the webworkify module with @Ambroos's webworkify-webpack-dropin module. The webpack app is working with this solution but the react app using nwb is not. If anyone has any experience with nwb or is feeling helpful, take a look at these projects. Any help would be appreciated! https://github.com/vpowers/simple-react-app |
Has anyone been able to give the build in my previous comment a try? Would really appreciate any feedback on whether it works in any of your custom builds or what breaks. |
@mjneil Thanks 😃 |
Hi @mjneil , |
@mjneil |
@mjneil I have tested it with a Laravel Mix / VueJS setup and it works like a charm! Thanks 😃 |
Thank you @rparjun @alexandrzavalii and @kapersoft for testing it out and confirming it works. v5.13.0 of videojs-contrib-hls has been released that include these fixes! Anyone looking to support webpack should upgrade to 5.13.0 and should be able to include the project without extra webpack configuration. I am closing this issue as resolved. Please reopen the issue or create a new one if you experience any issues after updating. |
@mjneil Thanks 😄 |
@mjneil thanks for the awesome effort. FYI, with v5.13.0 I'm still getting the unexpected identifier issue Anyone else have that problem? |
@ffischetti I have tested v5.13.0 with my Laravel Mix / VueJS setup and didn't experience any problems. |
@ffischetti do you import i have webpack + react + videojs + videojs-contrib-hls and with latest version everything works fine do you still have any "hacks" left maybe? |
Thanks @thecotne I'm doing: import 'videojs-contrib-hls,' as when I try to import videojs-contrib-hls/dist/videojs-contrib-hls.min, I get the following error: videojs-contrib-hls.min.js:2 Uncaught TypeError: Cannot read property 'EventTarget' of undefined https://github.com/Peer5/videojs-contrib-hls.js works fine. But video-js-contrib-hls throws the unexpected token '{' error. FYI, the app is bootstrapped with create-react-app. |
@ffischetti |
if you import like this import 'videojs-contrib-hls'
import videojs from 'video.js' it should work (works for me) |
@thecotne I'm doing exactly that and it throws the error. I'm aware that videojs-contrib-hls.js is a different package. I trying to point out that I seem to be experiencing the same state the others did prior to the fix. I appreciate the help and it's totally possible I'm doing something wrong. However, I suspect that some other dependency or action might be necessary to get v5.13.0 working with create-react-app, and that just hasn't been made explicit. Out of curiosity, does anyone have this working with create-react-app? If so, please share any details. They'd be much appreciated. Thanks in advance! |
@ffischetti I can take a look into this if you can share a repo where i can reproduce this issue. |
Hi @rparjun, Thanks for the kind offer. I've created a very basic app that will allow you to reproduce the issue: Please let me knows if this helps or not. Thanks! |
@ffischetti it looks like its the way react activates the css-loader is causing issues, its using the inline with json object options method. Looks like the keys of that json options object have |
@ffischetti this should be fixed in v5.14.0 |
Confirmed it's working. You rock. Thanks @mjneil ! |
Worked for me too, with Webpack (2!) and VueJS. |
In the version of 1.x videojs-contrib-hls, I can shim the package like this:
However, in 2.0.1 videojs-contrib-hls, this method doesn't work.
A dependency called
webworkify
will throw an errorWill videojs-contrib-hls plan to support webpack in the future?
The text was updated successfully, but these errors were encountered: