我正在開發一個 React 應用程式,我使用了一些 npm 模塊,其中一個我必須自己構建。
我的 NPM 包
這是一個簡單的模式,使用 useState() 打開和關閉
由于我匯入了我的包,我的控制臺中出現了一個錯誤,幾秒鐘后突然出現而沒有執行任何操作。
Uncaught (in promise) localhost/:1
>{message: 'A listener indicated an asynchronous response by r…age channel closed before a response was received'}
message: "A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received"
>[[Prototype]]: Object
>constructor: ? ()
>[[Prototype]]: Object
/* sometimes there are specific elements in addition but I could not check when they appear and when not */
Promise.then (asynchrone)
(anonyme) @content_script_bundle.js:108
handleNewFeatures @content_script_bundle.js:101
handleUpdatedNodes @content_script_bundle.js:101
(anonyme) @content_script_bundle.js:101
childlist(asynchrone)
0 @purplebox.js:1
(anonyme) @purplebox.js:1
v @purplebox.js:1
控制臺img中的錯誤
它不會阻止我的頁面,也不會阻止其功能的正常運行,但這是一個錯誤,我認為應該修復它,也許可以幫助遇到同樣問題的其他人。
我指定我不在此專案中發出任何異步請求。一切都是本地的,我使用的少數資料直接以原始形式匯入。我也不知道Purplebox.js是從哪里來的。
謝謝
uj5u.com熱心網友回復:
這個問題是一個跨域請求問題,它是由各種 Chrome 擴展程式引起的。我在我的 Angular 應用程式中也有這個,在隱身模式下測驗后,錯誤不再出現。
更多資訊:谷歌論壇
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/487761.html
標籤:javascript 反应 npm
