question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Larger bundler size when importing next-firebase-auth than expected?

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kmjennisoncommented, Aug 3, 2021

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:

With NFA: Screen Shot 2021-08-03 at 10 50 29 AM

Without NFA: Screen Shot 2021-08-03 at 10 48 35 AM

Without NFA but with Firebase: Screen Shot 2021-08-03 at 11 06 41 AM

Firebase’s size should be reduced when #164 is implemented.

0reactions
krthushcommented, Aug 3, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found