-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Dynamic imports #728
Comments
@rauchg is this for pages or for anything? |
@arunoda anything. Might require whitelisting in config though |
This already works |
@impronunciable oh really :) |
Wow, it works on the dev server but not when build + start 🤔 |
@impronunciable May be dev server serves necessary API endpoints. We may need to allow them in the production for exported chunks. |
I think this could be easily doable. May be this is the same functionality as |
Webpack supports this out of the box and it works just like |
@mxstbr We are using the webpack version but need to adapt our server to allow it |
Notes: We need to support SSR with dynamic imports too. In that case, let's say user imported the component inside Since we don't execute |
Super excited for this to land - is https://github.com/zeit/next.js/compare/import-then getting PR'd any time soon so I can follow along on that thread? |
@jesseditson yes. We are doing a PR soon. |
Excited for this. I've found that if server-side rendering with firebase you need to use |
I was trying to import a client side library (react-leaflet), but was getting errors when this library was getting loaded on the server side for first time page rendering. Making the library to load conditionally was a easy option. Any workaround for this for the time being? Code :
|
It seems that this issue is resolved in Next.js 3.0, isn't it? |
@frol Yep. Thanks. |
We should make it really easy to load modules dynamically.
For example, to only load some code client side:
The text was updated successfully, but these errors were encountered: