Preact构建模板执行失败:错误:没有找到XMLHttpRequest兼容性库



我在预构建时遇到了以下错误。

× ERROR Template execution failed: Error: The XMLHttpRequest compatibility library was not found.
然而,preact开发模式在相同的代码库中工作得很好。我使用preact-cli默认模板。什么好主意吗?编辑:似乎是firebase造成的。不知道为什么。如有任何帮助,不胜感激。
Build  [=================== ] 93% (14.4s) after chunk asset optimization[2021-01-25T20:12:57.501Z]  @firebase/app: 
Warning: This is a browser-targeted Firebase bundle but it appears it is being
run in a Node environment.  If running in a Node environment, make sure you
are using the bundle specified by the "main" field in package.json.

If you are using Webpack, you can specify "main" as the first item in
"resolve.mainFields":
https://webpack.js.org/configuration/resolve/#resolvemainfields

Preact团队回答-使用-no- preender标志构建,因为Preact默认使用preender构建,这需要节点env。

最新更新