说好2017Fix的还是能重现,可能项目的版本比较旧了,简要记录解决办法
1.错误:
index.js?bed3:67 Uncaught TypeError: self.postMessage is not a function at sendMsg (index.js?bed3:67) at Object.invalid (index.js?bed3:83) at SockJS.onmessage (socket.js?57b2:41) at SockJS.EventTarget.dispatchEvent (sockjs.js?3600:170) at eval (sockjs.js?3600:887) at Array.forEach (<anonymous>) at SockJS._transportMessage (sockjs.js?3600:885) at WebSocketTransport.EventEmitter.emit (sockjs.js?3600:86) at WebSocketTransport.ws.onmessage (sockjs.js?3600:2961)
2. 解决办法:打开文件 node_modules\webpack-dev-server\client\index.js , 找到 67行(或sendMsg方法)补充类型判断条件 && typeof self === ‘function‘
如图:
原文地址:https://www.cnblogs.com/dzone/p/11496642.html
时间: 2024-10-02 11:35:51