Preact build Template execution failed: Error: The XMLHttpRequest compatibility library was not found

Preact build Template execution failed: Error: The XMLHttpRequest compatibility library was not found

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

× 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-prerender 标志构建,因为默认情况下 Preact 使用预渲染构建并且需要节点环境。