3 ms·
> `await import('./foo.js')` could kick off a speculative fetch for foo.js Interesting, and kind of makes sense. However: > Of course that doesn't help for d
by theefer 10y ago
> `await import('./foo.js')` could kick off a speculative fetch for foo.js
Interesting, and kind of makes sense.
However:
> Of course that doesn't help for dynamic cases like `` await import(`./language-packs/${navigator.language}.js`) ``.
Isn't that the main, possibly only advantage of `await import(...)` though?
For static import names, why write `const x = await import('x');` if you can simply write `import x from 'x';`?
- domenicd 10y agoBecause await import() can be used inside if statements or similar.