Lazy-loading React components with webpack 2+ dynamic import and code-splitting

Lazy-loading React components with webpack 2+ dynamic import and code-splitting

James Skarzinskas

6 лет назад

8,374 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ivan Koryakovtsev
Ivan Koryakovtsev - 10.08.2018 04:34

Nice tutorial!

Ответить
Yu Mao
Yu Mao - 10.12.2017 16:16

Thanks for the code example, it's exactly what I am looking for

Ответить
Naveen N
Naveen N - 07.11.2017 05:30

Had couple of doubts.
I'm actually looking for something similar for dynamic layout templating where I'm planning to import components dynamically as per the JSON.(could also work as a part of code splitting)

1. How does this work for server side rendering.

2. Does dynamically imported component gets chunked in to a separate Js file with Webpack 2, and gets referenced internally( gets called with in app.js or it should be externally included )

Can you suggest how to proceed further that would help.

Ответить
nag bharadwaja
nag bharadwaja - 10.10.2017 23:01

Also, is there another way to make this dynamic import into the parent component other than storing it into its state ? Is this the ideal way to work with when dealing with large scale application and any state management frameworks like redux?

Ответить
nag bharadwaja
nag bharadwaja - 10.10.2017 22:58

great tutorial! thank you so much. I have a quick question. the lazily loaded component's bundle which is loaded to browser, where in the code is the app making that call to grab that lazily loaded bundle from the server? Or did I misunderstand the actual workflow here? Your response is very helpful.

Ответить