-
Notifications
You must be signed in to change notification settings - Fork 27k
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 import is loading all dependency even it's lazy loaded. Next 7.0.0 #5221
Comments
Probably dupe of #5213 |
@tusbar Yes.. Maybe it's related? using your repo it's correctly loaded the dynamic component on demand when i do |
This worked for me:
|
@dnakov Oh wait. i didn't pay attention to your code. you're trying to return anonymous function within dynamic function? my typescript compiler is complaining about that
|
yeah, sorry, this wasnt typescript-correct. just meant that i put the import in a function so it doesn’t get loaded immediately |
@dnakov no problem, i get your idea. Thanks. 👍 |
#5249 fixes this issue. |
Thanks @timneutkens ! Will try after release |
This works using next 7.0.1-canary.2:
|
@ptdede I've updated your comment to use the recommended syntax 🙌 |
Bug report
Describe the bug
on "next": "^7.0.0", dynamic import is importing ALL of the module that is supposed to lazy loaded. unlike "next": "^6.1.2", the module is correctly loaded on demand.
To Reproduce
this component is used only on route /b. But, on route /a it's already loaded.
Expected behavior
Dynamic imported module loaded when it's needed. like on next 6.1.2.
Screenshots
"next": "^6.1.2"
on route /a
TextSideSlider component is not loaded.
on route /b
TextSideSlider component is loaded correctly on demand.
"next": "^7.0.0",
on route /a
TextSideSlider component is already loaded
on route /b
nothing changed
System information
The text was updated successfully, but these errors were encountered: