-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
// dynamicImportExample.js
// Using dynamic import to load the math module
console.log("dynamically importing ./math.mjs");
import('./math.mjs')
.then((mathModule) => {
// Now you can use the functions from the loaded module
const result1 = mathModule.add(5, 3);
const result2 = mathModule.subtract(10, 4);
console.log('Addition result: 5, 3 -> ', result1);
console.log('Subtraction result: 10, 4 -> ', result2);
})
.catch((error) => {
console.error('Dynamic import error:', error);
});
Metadata
Metadata
Assignees
Labels
No labels