Monday 16 July 2018

videojs with brightcove giving error using require.ensure in React component

I'm trying to use require.ensure in my react component:

componentDidMount() {
    require.ensure([], () => {
        require('public/jscripts/brightcove/index.js');
    });
}

but keep getting an error: Cannot set property 'default' of undefined

It happens at this point in the brightcove videojs script:

// At this point, `window.videojs` will be the earliest-defined copy of this
// version of videojs.
var videojs = window.videojs;

// https://github.com/videojs/video.js/issues/2698
videojs['default'] = videojs;

Does anyone know why this might be happening?

The full script is here btw, I saved it as a local file hence the path public/jscripts/brightcove/index.js: https://players.brightcove.net/1752604059001/B1xXFuBodW_default/index.js



from videojs with brightcove giving error using require.ensure in React component

No comments:

Post a Comment