-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebpackError: ReferenceError: IDBIndex is not defined while building with Gatsby.JS (ver #2.15.21) #2222
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
One way I could get it to build was degrading down to [email protected] from [email protected] |
So, good news, I have 2 solutions for you. Background: this is happening during the SSR step, or The best solution is probably to force Webpack to import Firebase with the
Gatsby's webpack config is already doing this for a number of its own deps, this is just concatting an additional function to do the same to Firebase bundles. Another option is to explicitly dynamically import (lazy load) firebase in your code, in the highest-level component that uses firebase. You would put a statement such as this:
in your Here's an external blog post that goes into more detail about the lazy-loading solution: https://kyleshevlin.com/firebase-and-gatsby-together-at-last |
Amazing! Thank you so much for the coherent breakdown of the solution and providing not one, but 2 of them! Really appreciate it, and the first solution worked great 👍 ! |
Just a tiny comment, after adding the first fix, the project complains about some files in the '.cache' folder of gatsby while trying to run |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
Gatsby.js cannot build the final app.js file due to issue in any of the firebase packages. While building, when it it hits
import firebase from 'firebase'
, gatsby throws the following error :Relevant Code:
import firebase from 'firebase';
The text was updated successfully, but these errors were encountered: