标签:pac nbsp self server fun function elf tar modules
说好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‘
如图:
简记webpack运行报错 Uncaught TypeError: self.postMessage is not a function
标签:pac nbsp self server fun function elf tar modules
原文地址:https://www.cnblogs.com/dzone/p/11496642.html