-
Notifications
You must be signed in to change notification settings - Fork 6
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
Remove Next from peer dependencies #38
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
@donaminos this is a work in progress, but what do you think? This gets rid of any peer dependencies, which are a pain. It's not really possible to have optional deps nowadays as most bundlers statically analyse all imports, which cause all sorts of problems to our consumers that are not using |
Thanks a lot @jfranciscosousa for looking into this. I am a bit short on time this week but I will try my best to review it before the end of the week |
@jfranciscosousa thanks a lot for looking into this. I like this approach but something is not clear in my mind. Why do you want to add an optional dependency for Next? The idea is to use the browser API by default and the consumer should pass a customer implementation if he/she wants to use a router from a framework. isn't it? did I misunderstand this PR? |
@donaminos I think you are misunderstanding the PR. I'm removing Next.js from the optional dependencies. Currently we have to add We are using an adapter pattern for this package (default or next.js). I'm instead replacing it with full control. Instead of providing an adapter, we can let consumers of this package customize This way we have no need of maintaining peer dependencies, and our consumers can use the package as they wish. For our specific use case on our platform, we would have to use a Btw, for some reason Github completely ignored the description I wrote for this PR. I'll write it later when I get back from PTO. |
| `Wrapper` | `React Component` | A component to wrap each modal with | | ||
| `usePortal` | `boolean` | Should this modal be mounted on a portal | | ||
| `portalElement` | `HTML Element` | A component to mount the modals in, defaults to body | | ||
| `adapter` | `null or "nextjs"` | If set to NextJS it will use next router instead of history API | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was what we had before @donaminos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it's what our platform uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any user trying to use this package without Next.js was going to get a build error as optionalDeps
are not a thing on modern JS bundlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just check the existing issues for this project.
Thanks a lot for this clear explanation. It makes total sense 👍 |
No description provided.