react项目在ie11浏览器运行报错Instance method `debug.destroy()` is deprecated and no longer does anything

react项目运行时,ie11浏览器报错:Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`

一开始也是摸不着头绪, 后面发现是sockjs-client插件的问题,先是升级这个插件,没能解决问题,后面又降级,还是一样,最后在yarn.lock文件发现在webpack-dev-server插件下也有这个插件,索性将webpack-dev-server从3.1.0升级为3.11.0,这样就解决问题了.

虽然页面正常显示了,但是又报5022的错误:

SCRIPT5022: SecurityError              

点击进入发现指向这段代码:

var Driver = global.WebSocket || global.MozWebSocket;
if (Driver) {
 module.exports = function WebSocketBrowserDriver(url) {
  return new Driver(url);
 };
} else {
 module.exports = undefined;
}

根据代码很容易就找到是sockjs-client/dist/sockjs.js文件

查了网上的资料,说是到node_modules里面sockjs-client/dist/sockjs.js文件中注释掉self.xhr.send(payload),再重启项目刷新页面

我这个项目是不让修改node_modules的,好在ie浏览器虽然报错,没有影响到页面的正常展示.

你可能感兴趣的:(插件,react.js,javascript,兼容ie11浏览器)