简记webpack运行报错 Uncaught TypeError: self.postMessage is not a function
Posted dzone
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简记webpack运行报错 Uncaught TypeError: self.postMessage is not a function相关的知识,希望对你有一定的参考价值。
说好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的主要内容,如果未能解决你的问题,请参考以下文章
Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<
Vue的报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<
Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法(代码片段
运行PHP-Parser报错:PHP Fatal error: Uncaught Error: Class ‘PhpParserParserFactory‘ not found
Webpack Babel 加载错误 - Uncaught SyntaxError: Unexpected token import [重复]
使用 webpack 获取 'Uncaught TypeError: $(...).tablesorter is not a function'