Import VS require ? | Sololearn: Learn to code for FREE!


Import VS require ?

Can someone please explain to me what's the major difference between import and require

4/13/2020 5:50:49 AM


4 Answers

New Answer


Dynamic import is ES2020 feature with import() operator, it is asynchronous and it returns a promise. You can import in the code blocks instead of globally, and use .then .catch .final or async await to handle the resolve and reject of the promise.


Thank you soo much for this article it really helped but i have a follow up questions what's a dynamic import what's tree shaking


Thank you so much