firebase - 使用 preact-cli 的 Cloud Firestore 构建错误
问题描述
我正在尝试从 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
解决方案
推荐阅读
- dart - 当其中一些没有前导对象时对齐 ListTile 项目
- algorithm - 修改二分查找以查找大于 x 且小于 2x 且时间复杂度优于 O(n) 的数组中的所有整数
- asp.net-core - 从 ActionFilter 中的 FluentValidator 检索 ErrorCode
- python - 如何在保留现有权限的同时使用 os.chmod 更改文件权限?
- django - 在 for 循环中过滤和计数
- r - 通过系统调用使用 rtools grep/pipe 组合
- angularjs - 如何知道 angular-busy 的 cg-busy 何时主动显示(或者我如何为承诺链强制执行 minDuration)?
- php - 未捕获的异常 PDOException 即使语句在 try/catch 块中
- python - Windows IIS 服务器上的 Python3。需要无缓冲输出实时输出
- ios - Strava 阿拉莫火令牌