问题描述
我正在尝试从 preact-cli 生成的项目中使用 Firebase 的 Cloud Firestore,但遇到了第一个障碍。我选择了 Firebase 的 v9 SDK,它处于测试阶段,以领先于曲线(但也许这是一个错误)。构建时,Firebase SDK 文件出现错误,但我不确定它是否由 SDK 本身、babel、webpack、preact-cli 或组合引起。我也不知道如何诊断它,因为我是这些工具的新手。
以下步骤,您知道此错误的原因可能是什么吗?
npx preact-cli create typescript webapp
npm install --save firebase@9.0.0-beta.1
然后在 src/components/app.tsx
中,通过添加来使用 Firestore SDK
import { getFirestore } from "firebase/firestore";
getFirestore();
但构建失败。
$ npm run build
> webapp@0.0.0 build
> preact build
Build [== ] 12% (1.3s) building(13200:6) switch-case fall-through not supported - added break. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification
[BABEL] Note: The code generator has deoptimised the styling of ../node_modules/@firebase/firestore/dist/exp/index.browser.esm2017.js as it exceeds the max of 500KB.
✖ ERROR ../node_modules/@firebase/firestore/dist/exp/index.browser.esm2017.js 5055:431
Module parse Failed: Unsyntactic break (5055:431)
File was processed with these loaders:
* ../node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
(Source code omitted for this binary file)
@ ../node_modules/firebase/firestore/dist/index.esm.js 1:0-36 1:0-36
@ ./components/app.tsx
@ ./index.ts
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)