firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.76k stars 873 forks source link

Function statements require a function name on production build #5900

Open danielo515 opened 2 years ago

danielo515 commented 2 years ago

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

This is exactly the same as #5674 and #5740 As explained on both two issues, when you use firebaseAuth on the production build you get this error on first page load. I am using Vitejs as a bundler and the rest is basic cra react app

Steps to reproduce:

Not sure how to reproduce it other than triggering a production bundle with minification.

Relevant Code:

danielo515 commented 2 years ago

https://github.com/vitejs/vite/issues/6546

hsubox76 commented 2 years ago

Seems like esbuild may be the common element between the build pipelines reporting the error (Angular, Vite). Although one user reported using preact-cli (Webpack 4).

There is a (fixed) bug in rollup that led to a message like this. https://github.com/rollup/rollup/issues/4105 Not necessarily related to the exact problem there (sequence elements) but possibly a similar bug in Vite/esbuild/? leading to a function declaration being put somewhere that an expression is expected? Will keep looking into it.