function makeCamelCase(text) { const changeCase = import('https://cdn.skypack.dev/change-case') return changeCase.camelCase(text) }
function makeCamelCase(text) { const changeCase = import('https://cdn.skypack.dev/change-case') return changeCase.camelCase(text) }
This import statement is actually a dynamic import. When it’s first called, it will fetch the module’s code from the CDN url and parse it asynchronously, which means import() returns a promise. We either need to use the .then() method or async/await to access the module.
async function makeCamelCase(text) { const changeCase = await import('https://cdn.skypack.dev/change-case') return changeCase.camelCase(text) }