码迷,mamicode.com
首页 > Web开发 > 详细

简记webpack运行报错 Uncaught TypeError: self.postMessage is not a function

时间:2019-09-10 13:25:34      阅读:548      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!