-
Notifications
You must be signed in to change notification settings - Fork 898
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
package.json exports should include "browser" for @firebase/firestore #6414
Comments
Hi @jbalidiong Thanks for the fix. The If I do something like
I still get the same error. |
It's not the same problem as before. The other fix was because the firestore/lite exports field was pointing to the firestore bundle, which I guess causes this problem when loaded. Pointing to the firestore/lite bundle avoided importing the problem bundle. Deliberately going back to importing the firestore bundle causes the same error which makes sense, because that was the same file being imported before, which the "firestore/lite" path was mistakenly pointing to. The actual error is puzzling because it seems like it doesn't recognize |
I can't reproduce this error. I've followed the instructions above and put this in
Everything seems to work fine, it's fetching and displaying the data. I haven't touched any of the other files in the template. Is there anything else I should be doing? |
@aalakoski, can you provide a minimal reproducible example? Or otherwise, can you review the attempt to reproduce in the previous comment? |
Hey @aalakoski. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Since there haven't been any recent updates here, I am going to close this issue. @aalakoski if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this. |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
the
import { getFirestore} from 'firebase/firestore/lite'
(and firebase/firestore) will result in a following error:Uncaught TypeError: Cannot read properties of undefined (reading 'stringify')
which point to theindex.esm2017.js:27
file.I'm trying to use Firestore with Svelte (v.3.0.0) with Typescript and Rollup config. In my rollup.config.js I have:
I believe this is due to incorrect export configuration and mainly them missing the "browser" diist destination.
When you add the following line to node_modules/@firebase/firestore/package.json everything works and the build does not crash for the import:
Steps to reproduce:
Clone / create a new Svelte app with Typescript:
npx degit sveltejs/template firebase-test
cd firebase-test
node scripts/setupTypeScript.js
npm i firebase -D
Add the
browser: true
option to resolve in rollup.config.jsStart dev server:
npm run dev
When you open your browser with the default served local env
http://localhost:8080
You'll see the issue.
Modify the above package.json to include "browser" exports.
restart your dev server with:
npm run dev
No errors in web console.
Relevant Code:
In your App.svelte just import the getFirestore from firebase/firestore/lite
The text was updated successfully, but these errors were encountered: