【问题标题】:Preact build Template execution failed: Error: The XMLHttpRequest compatibility library was not foundPreact 构建模板执行失败:错误:找不到 XMLHttpRequest 兼容库
【发布时间】:2021-01-25 20:03:10
【问题描述】:

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

× 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

【问题讨论】:

    标签: javascript preact


    【解决方案1】:

    由 Preact 团队回答 - 使用 --no-prerender 标志构建,因为默认情况下 Preact 使用 prerender 构建并且需要节点 env。

    【讨论】:

      猜你喜欢
      • 2017-05-04
      • 2018-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-15
      • 2018-04-09
      • 2018-10-22
      • 1970-01-01
      相关资源
      最近更新 更多