簡體   English   中英

該插件文件同時使用CommonJS和ES6模塊系統,我們不支持

[英]This plugin file is using both CommonJS and ES6 module systems together which we don't support

我開發了一個調查軟件,但是我的gatsby-browser.js存在問題

蓋茨比2.8.2

PS C:\Users\Jovan Bienvenu\Desktop\polling-app> gatsby develop
success open and validate gatsby-configs - 0.074 s
error This plugin file is using both CommonJS and ES6 module systems together which we don't support.
You'll need to edit the file to use just one or the other.

plugin: C:/Users/Jovan Bienvenu/Desktop/polling-app/gatsby-browser.js

This didn't cause a problem in Gatsby v1 so you might want to review the migration doc for this:
https://gatsby.dev/no-mixed-modules

用於將firebase auth與所使用的gatsby集成的polling-app演示代碼是用Gatsby的V1編寫的……在V2中,您無法將es6樣式的導入和導出與早期版本混合使用。 -該演示代碼在使用import語句時使用exports.replaceRouterComponent。

使用以下方法修復它:

const replaceRouterComponent = ({ history }) => {
  const ConnectedRouterWrapper = ({ children }) => (
    <FirebaseProvider firebase={firebase}>
      <Router history={history}>{children}</Router>
    </FirebaseProvider>
  );

  return ConnectedRouterWrapper;
};

export default replaceRouterComponent

但是-該代碼也缺少從React Router到@ reach / router的V2開關。

基本上,它是一個舊代碼,您可能應該考慮使用其他插件或方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM