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. I am using preact-cli with default template.
Any ideas?

Edit: It seems like firebase might be causing it. 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

62 thoughts on “Preact build Template execution failed: Error: The XMLHttpRequest compatibility library was not found”