Closed mikeover closed 3 years ago
Hi @mikeover, sorry to hear it isn't working.
I tried to reproduce this in https://stackblitz.com/edit/reactfire-v4-issue-433?file=index.js, but it seems to work without issue. Can you see a difference between my code and yours? If not, this may be a build issue or a JS SDK issue
Side note: since you're using ReactFire's concurrent mode features, it would be safest to follow the React docs' setup instructions using an experimental build of React and
ReactDOM.unstable_createRoot
instead ofReactDOM.render
.
note: this issue was also posted to https://github.com/firebase/firebase-js-sdk/issues/5384
Something else I noticed is that your yarn start
script uses check-config
and wraps the build with env-cmd
, while yarn start:dist
does not. env-cmd
may set some environment variables that are important to your app, so maybe look into wrapping your start:dist
command to something like:
"start:dist": "yarn check-config && env-cmd \"yarn build\" && firebase emulators:start --only hosting"
thanks @jhuleatt , I coped your index.js
from your stackblitz and ran it with yarn start:dist
and it blew up in the same way so I am thinking it is a build issue. I tried your suggestions to the script but had the same result. Any other ideas for things I could try before I just revert back to v3?
Hmm, my only other guess would be to try installing reactfire@exp
. There's a chance that a recent commit (https://github.com/FirebaseExtended/reactfire/commit/cc0c93e955fae046b96036c27706da83f0809b9f) made after ReactFire 4.0.0
was released may help.
It seems to be a build/minification issue. Is it possible to disable minification in the prod build, so that we can pin down the root cause?
I am also having this issue. I am working on transitioning to firebase v9 and reactfire v4 and the preview channel is failing. Here is the code that is failing https://github.com/epodol/bsclibrary/pull/349. (You can see a preview channel link there too)
After updating to reactfire@exp
, the issue was resolved. Thanks!
@jhuleatt Do you think you could release a new version with these changes? Thanks!
Issue
Works fine in dev but when building for production, I get a blank screen and this error in the console:
Steps to reproduce:
This runs fine with
yarn start
but fails after building for production withyarn start:dist
(see package.json scripts below).Relevant Code:
index.jsx:
App.js:
package.json scripts:
dependencies: