MENU
import()
Say, you have exported a function from math.js:
RESETRUNFULL
export function add(a,b){
return (a+b);}
Before (with static import):
RESETRUNFULL
import { add } from './math';console.log(add(16, 26));
This will include the add function into the single bundle.
After (with dynamic import):
RESETRUNFULL
import("./math").then(math => {
console.log(math.add(16, 26));});
This will automatically split the bundle for you.
For more information on how to perform exports and imports, refer to the MDN tutorial: