明月笑刀無情
2021-12-23 16:55:28
在 IE11 中使用video.js播放器無法加載視頻片段。如果我查看控制臺,我會看到“InvalidStateError”錯誤。違規(guī)行位于包的xhr庫依賴項中video.js:// node_modules/video.js/node_modules/xhr/index.js#L210| if ("responseType" in options) {> xhr.responseType = options.responseType| }如果我在我的電腦上手動刪除這條線,播放器就會工作。我怎樣才能解決這個問題?我正在使用 webpack 構(gòu)建我的應(yīng)用程序。
1 回答

蠱毒傳說
TA貢獻1895條經(jīng)驗 獲得超3個贊
這很hacky,但您可以使用該webpack-plugin-replace插件通過將其替換為空字符串來刪除該行。
// fixes "InvalidStateError" in IE which occurs at:
// node_modules/video.js/node_modules/xhr/index.js#L210
new ReplacePlugin({
include: [
"/node_modules/video.js/node_modules/xhr/index.js"
],
patterns: [
{
regex: /xhr\.responseType = options\.responseType/,
value: ''
}
],
// required due to a bug in `webpack-plugin-replace`
// see: https://github.com/lukeed/webpack-plugin-replace/issues/6
values: {
"": ""
}
})
添加回答
舉報
0/150
提交
取消