我们使用firebase和solr创建了项目。
下面是我们应用程序的当前文件夹结构。
--src
--actions
--assets
--components
--controllers
--firebase
--reducers
--utils
--app.js
现在,为了将app转换为下一个js,我在依赖项中添加了下一个js,并将脚本更改如下
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
现在,我在"src“文件夹中创建了目录”page“,并添加了"index.js”hello world react程序来测试下一个js,它通过运行脚本"npm run“来工作。
因此,我将所有文件夹从“控制器”复制到“页面”文件夹,并尝试访问静态页“约”。
在这里,我的错误越来越少,
有时会出现以下错误:
Firebase:名为“DEFAULT”的Firebase应用程序已经存在( App /复制-app)。在同一页上,重新加载一段时间后,此错误:
FirebaseError: projectId必须是FirebaseApp.options中的字符串
What other things to do more to convert existing react app to next.js?
发布于 2020-09-18 04:07:53
我在Next.js中看到了这个火基错误,并多次响应本机。我认为这与渲染或其他相关,但以下是解决方案:
firebase.js
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
let config = {
// your config
};
export default !firebase.apps.length
? firebase.initializeApp(config)
: firebase.app();
https://stackoverflow.com/questions/63955438
复制