简体   繁体   English

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

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

I am facing below error on preact build.我在预构建时面临以下错误。

× ERROR Template execution failed: Error: The XMLHttpRequest compatibility library was not found.

however, preact dev mode is working fine with same codebase.但是,preact 开发模式在相同的代码库下运行良好。 I am using preact-cli with default template.我正在使用带有默认模板的 preact-cli。 Any ideas?有任何想法吗?

Edit: It seems like firebase might be causing it.编辑:似乎 firebase 可能导致它。 Not sure why.不知道为什么。 Any help is appreciated.任何帮助表示赞赏。

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

Answered by Preact team - Build using --no-prerender flag because by default Preact builds with prerender and that requires node env. Preact 团队回答 - 使用 --no-prerender 标志构建,因为默认情况下 Preact 使用 prerender 构建并且需要节点 env。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM