Open Progression opened 2 years ago
Hey, thanks for the issue. There's definitely some finickiness around plugins. We'll take a look next week.
Looking at the vite docs, I can see that they actually ship with it built-in: https://vitejs.dev/config/shared-options.html#resolve-alias
However, I fonud out why this isn't working. We're bundling video.js into the built file, so, there is always two versions of Video.js around. I'll take a look at how to separate it out so that aliasing will start working again.
Figured out a workaround. If you alias video.js to point at videojs-mux-kit itself, it works:
import { defineConfig } from 'vite';
export default defineConfig({
resolve: {
alias: {
'video.js': '@mux/videojs-kit',
},
},
});
I have a live example over here: https://stackblitz.com/edit/vitejs-vite-v8dbe2?file=main.js,package.json,vite.config.js&terminal=dev
@Progression hopefully, that unblocks you. I'll continue looking into how to make the build better, though. I'm not sure that there's a way to avoid aliasing altogether, unfortunately.
Gary, that is great, thanks so much for looking into this. I'm unable to try this out myself tonight but will see if I can jump over to this tomorrow and get it working. Will let you know.
@gkatsev's solution also worked for me running webpacker in Rails with the videojs-record
plugin.
I changed the alias from 'video.js': 'video.js/core'
to 'video.js': '@mux/videojs-kit'
and it finds the plugin and works.
I need to use some plugins but am having issues getting them to work with the videojs-mux-kit version.
I have seen the note at the end of the readme regarding video.js/core situation. I've tried both solutions:
I guess what I'm really interested in knowing is has anyone got plugins to work with the latest version of videojs-mux-kit?