繁体   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