Larger bundler size when importing next-firebase-auth than expected?
See original GitHub issueDescribe the bug Seems like there is some issue with bundle size, when importing next-firebase-auth, that leads to a considerably larger bundle size than expected.
In my case “without” using import { … } from ‘next-firebase-auth’; gives a package size for firstload of a page of 75.1kb, then we usinng the imports the size jumps to 143kb - I read elsewhere you should only expect the size to be around 20kb?
Version “next-firebase-auth”: “^0.13.2”
To Reproduce with using next-firebase-auth [username].tsx
...
import initAuth from '../initAuth';
import { AuthAction, AuthUserContext, withAuthUser } from 'next-firebase-auth';
initAuth(); // Required if page uses any auth calls related to next-firebase-auth
....
export default withAuthUser({
whenUnauthedBeforeInit: AuthAction.RENDER,
whenUnauthedAfterInit: AuthAction.RENDER,
})(Profile)
without using next-firebase-auth [username].tsx
....
export default Profile
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Support Modular Firebase 9 #164 - GitHub
Firebase bundle size is huge. Version 9 introduces a new import strategy that significantly reduces bundle size.
Read more >Reducing Firebase Bundle Size NextJS - Stack Overflow
Then, I call const user = useContext(AuthContext); in my pages to get the user session data. To use Firestore or functions, I import...
Read more >Bundle Size Comparison in Firebase Modular SDK | miyauci.me
The bundle size of the V9 Modular SDK should increase as more functions are used. Also, the bundle size will vary depending on...
Read more >cannot read properties of undefined (reading 'auth') firebase
If your firebase version if greater than 7, you got to import from 'firebase/app' instead of 'firebase'. And you have to import *...
Read more >Simple Firebase Authentication for All Next.js Rendering ...
In this tutorial, We'll learn next-firebase-auth: Simple Firebase Authentication for All Next.js Rendering Strategies. Signed, secure, HTTP-only cookies by ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for this info. I explored this in the demo app and feel confident the bundle size is mostly Firebase JS.
First load JS for the example app index page:
next-firebase-app
(NFA): 136kbWith NFA:
Without NFA:
Without NFA but with Firebase:
Firebase’s size should be reduced when #164 is implemented.
Cool sounds good, yeah hopefully we’ll get the modular firebase support sometime and then we can further reduce the bundle size impact from firebase.