Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

ES2022 - Top-level await modules

// Using a fallback if module loading fails
let lodash;
try {
  lodash = await import('https://primary.example.com/lodash');
} catch {
  lodash = await import('https://secondary.example.com/lodash');
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #await #modules
ADD COMMENT
Topic
Name
6+5 =