Comments (7)
Importing next-auth/client
results in a
Error: only one instance of babel-polyfill is allowed
for us. I assume it's because we handle polyfilling ourselves in our custom webpack config already. Any advice on how I can proceed?
from next-auth.
Hello! Thanks for raising a ticket, I was going to raise one about this myself. I regard the bloat as a problem as well and want to address it in a future version.
Some options:
-
We don't need all of babel-polyfill, and we can (and should) cherry pick the features we actually need. If we could get this down to ~5-10KB I am probably not going to lose sleep over that, but I agree ~100KB is excessive. This is likely the first step as it's probably the quickest and easiest thing to do.
-
We could maybe distribute two versions of the client (and leave the default without IE support). If we did this, we would need to make sure that tree shaking works, so that only the version you are using actually gets bundled to the clients (and not both, which would just make things worse).
-
As you suggest we could try pushing the dependancy to those using next-auth, with instructions on what to do to include babel-polyfill. I agree this is preferable in principle, however I am not sure how we would do this as IIRC to work I think it needs to be included when the module is built.
from next-auth.
Regarding injecting the polyfills at the app level, I believe the order of execution depends on the order of imports, so if the app code imports babel-polyfill
before it imports next-auth
, the mutated polyfill globals should be there in the environment by the time any of the next-auth
code runs. See related Rollup discussion rollup/rollup#1459
I also sort of like the idea of distributing two versions of the client. Maybe it could just be another entry point to the library, looking something like this:
import { NextAuth } from 'next-auth/client/withPolyfills'
from next-auth.
AFIAK if an app imports babel-polyfill
before importing next-auth
, the polyfills will work correctly. This could be the recommended approach for apps that need IE support and depend on next-auth
. They do not need to be inside the Rollup bundle for next-auth
.
With this approach it would be safe to remove the polyfills from next-auth
completely.
Any thoughts?
from next-auth.
Just bumping to say I still plan to investigate this issue. I was just addressing some pressing issues and PRs which had been open for a while, but am going to try addressing this now.
from next-auth.
I am also getting the error @masone is getting. I'm not doing anything special but my app wont build unless is remove next-auth/client
.
Here is the repo
https://github.com/hipstersmoothie/kikbak.tv/
EDIT:
It seems if I import import { NextAuth } from 'next-auth/client';
once it works, but if I import it in twice (in two files) I get Error: only one instance of babel-polyfill is allowed
from next-auth.
v2 is out now and v1 isn't supported anymore.
from next-auth.
Related Issues (20)
- Invalid MongoDB schema for the prisma adapter (next-auth@beta) HOT 8
- Split configuration is not working
- useSession()'s session.update() does not trigger session update HOT 1
- v5 Beta does not work with Next 15 RC (React 19 RC) - Middleware issue HOT 3
- [v5] Throwing error with custom sign in page leads to undefined route HOT 5
- Strava provider returns Int for providerAccountId but Prisma adapter is expecting a String HOT 1
- Strava provider returns Int for providerAccountId but Prisma adapter is expecting a String
- Custom jwt encryption not working HOT 1
- update() does not work as documented HOT 1
- NextAuth is using an unsupported Node.js API (process.emit) HOT 1
- Firebase adapter Module not found: Can't resolve 'fs' ? HOT 1
- V5 Fails Behind Corporate Proxy with Provider HOT 1
- V5 Fails Behind Corporate Proxy with Provider HOT 1
- V5 Fails Behind Corporate Proxy with Provider
- Not signOut on Keycloak. HOT 1
- middleware error in Nextjs@15 : TypeError: _react.default.createContext is not a function HOT 8
- Session Data Inconsistency on Initial Login in NextAuth v5 Beta HOT 4
- refetchInterval does not send "update" trigger HOT 1
- refetchInterval does not send "update" trigger HOT 2
- Firebase adapter Module not found: Can't resolve 'fs' ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-auth.