作者:mobiledu2502889217 | 来源:互联网 | 2022-12-10 18:29
我正在尝试在反应组件中使用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.js
:https://players.brightcove.net/1752604059001/B1xXFuBodW_default/index.js