带有Brightcove的videojs在React组件中使用require.ensure产生错误

时间:2018-07-14 00:11:57

标签: node.js reactjs requirejs video.js brightcove

我正在尝试在我的react组件中使用require.ensure:

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

但不断出现错误:Cannot set property 'default' of undefined

这发生在Brightcove videojs脚本中:

// 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;

有人知道为什么会这样吗?

完整的脚本在这里,我将其保存为本地文件,因此路径为public/jscripts/brightcove/index.jshttps://players.brightcove.net/1752604059001/B1xXFuBodW_default/index.js

0 个答案:

没有答案