楔子
不是專業的前端,只是 需要使用,網上各種博客都是 官方那些,可以按照操作後 提示
Uncaught ReferenceError: videojs is not defined
解決
npm install @easydarwin/easyplayer --save
npm install --save-dev copy-webpack-plugin
1 copy-webpack-plugin
npm install --save-dev copy-webpack-plugin
webpack.dev.conf.js
## 引入
const CopyWebpackPlugin = require('copy-webpack-plugin')
在 module plugins 配置 上述
new CopyWebpackPlugin([
{ from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'},
{ from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'},
{ from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/'},
{from :'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer.swf'},
{from :'node_modules/@easydarwin/easyplayer/dist/component/crossdomain.xml'},
{from :'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer-lib.min.js'},
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
},
])
2 在index.html中引用
沒有在index.html中引入 就會 提示 Uncaught ReferenceError: videojs is not defined