-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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 with dynamic filenames #2037
Comments
No you can't do that. |
There's a similar issue in this issue list. Just search for that for more info. |
I see. Thanks for the link! Makes sense. |
@arunoda any examples of how to just dynamically import some lib as a promise? Having to jump through some crazy hoops (wrap every lib in a component?). Using regular webpack dynamic imports doesn't appear to work. |
I am working from next version 3.0.0-beta5. I have setup a demo application here: https://github.com/kylesuss/next-dynamic-issue
What I would like to do is to dynamically import components, but the filename to dynamically import will not be constant. For example:
https://github.com/kylesuss/next-dynamic-issue/blob/eb999951ed8e00134b192ea44b7f15b81f382706/pages/index.js#L10-L14
Is such a thing possible? Currently, I get an error:
TypeError: Cannot read property 'call' of undefined
When I change the code to hardcode the component path, all is well:
This seems to defeat my purpose for dynamic components. I understand there are concerns with module loading & server side rendering, but what's the best way to achieve something like this? Am I missing the point? Is this a bug / not yet implemented?
Thanks.
The text was updated successfully, but these errors were encountered: