mediacms-vjs-plugin is a custom plugin for Video.js.
The MediaCmsVjsPlugin.js source file starts with:
import { version as VERSION } from '../package.json';
import 'mediacms-vjs-plugin-font-icons/dist/mediacms-vjs-icons.css';
import './styles.scss';
As can be seen, there is no import of videojs. However, videojs is being used all over the code like:
function generatePlugin() {
const videojsComponent = videojs.getComponent('Component');
const videojsClickableComponent = videojs.getComponent('ClickableComponent');
const videojsComponentButton = videojs.getComponent('Button');
const __MediaCMSComponent__ = videojs.extend(videojsComponent, {
How is it possible to use videojs without importing it first?
Its package.json file specifies videojs as a peer dependency:
"peerDependencies": {
"video.js": "^7.12.3"
},
Could it be that whenever there is a peer dependency, we don't have to import it explicitly?
Since it's a plugin, It's likely written on the assumption that you already have videojs in your project and that you're importing it somewhere, before importing the plugin.