Dynamic Module Imports in JavaScript

preview_player
Показать описание
With ES Modules came the ability to use the import statement and export statement to manage our JavaScript as modules. Files could be divided and imported into each other. We could rely on the successful import of a file as the trigger to run the code.
ES Modules also gave us dynamic imports and conditional imports using the import method. This tutorial explains, with examples how to leverage dynamic and conditional imports in your code with the promise-based import method.

Рекомендации по теме
Комментарии
Автор

Your videos are super helpful! Thank you for making these short and easy to understand videos.

danielhult
Автор

This is top class content, right here.
With an amazing teaching style.
Thank you very much and keep it up!

MarshallSC
Автор

Perfect as always!!
And as always thanks for teaching!

jeanmarcpourchel
Автор

i use an “optionalmodules” module that just runs tests and creates a registry it passes back to my webpack entry. my webpack entry loads and inits these modules in different “load phases” like: phase onload, phase after major skin, phase before dismissing loading screen. phases help in a cms environment so i can transform dom from various 3rd party server modules to meet skin expectations.

tedfitzpatrickyt
Автор

If only we had a similar feature in CSS - dynamically imported modules.

bmehder
Автор

I like the he fact that we don't need that silly "module" anymore

Plrang
Автор

I was trying to making a conditional dynamically import of react-icons, but I'm hitting a wall, since I'll be receiving a string[ ] I don't know what I should do in the place of using destructuring since the purpose is pick some selected icons.

yurisoares
Автор

Please I want to know can't you use async await to solve the promise resolution at any time?

Elephant_official_dev
Автор

I learned how to use import and export today and I got this video. Looks like this is better as we can use modules if needed and handle errors. But does it cost performance if we use import repeatedly instead of once?

agent-
Автор

Is the Javascript loaded into browser when page loads and only bundled into main Javascript or does it load from the server when the import is called and then bundles it

abhim
Автор

What are the performance implications of dynamic importing?

HarshKapadia
Автор

Would be nice if you start making videos on Go

abhim