Best practice to use next/dynamic from an NPM library? #16914
Unanswered
transitive-bullshit
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a large React codebase that I'm hoping to open source via a reusable NPM React package.
The codebase uses
next/dynamic
strategically in several places to cut down on the minimal bundle size.My question is whether or not you know of any examples of using async imports with either
next/dynamic
or a similar solution from within an NPM library that can then be consumed by Next.js or any other Webpack-based bundler?One potential option would be to just use
next/dynamic
as a peer dependency in my library and require that anyone using the lib uses Next.js, but that doesn't seem ideal.btw, this is for an upcoming version of react-notion.
Beta Was this translation helpful? Give feedback.
All reactions