- The proposal
import await
gist- PR to proposal explainer
- slide from march meeting discussing
import await
- Issue for W3C TAG Review
- WebpackPR to add
import async
Concerns raised in initial import await
gist
- Asynchronicity of imported module is not visible
- Imports of async modules can have potentially performance impact and should be visible to the developer
- It's difficult to see which modules are affected by the top-level-await
- Once this is visible, developer can break the async chain with
import()
- Microticks between imports may be unexpected
- Developer don't know if modules are evaluated sync or async
- Execution order is no longer guaranteed when modules add top-level-awaits
- No more microticks unless there is top-level await
- If no top-level await in graph then it is executed synchronously
- Optmizes async execution
- Only the modules that include a Top-Level Await are run asyncronously
- Subsquent sub graphs are run synchronously
- No micro ticks for remaining graph
- Viral Syntax
- no way to introduce async module into graph without
import await
to root - use of
import await
defensively likely to happen
- no way to introduce async module into graph without
- wasm modules will be async
- will force introduction of wasm modules to be Semver-Major (and viral)
- Removes ability for engine to optimize async execution
import await
would force graph up to root to execute asynchronously- running
import async
modules synchronously would break developer contract
- It is my belief that
import await
is not a replacement forTop-Level Await
- This does not mean that others, e.g. webpack, should not experiment with the API
- this does not preclude
import await
from being presented to the committee as an additional proposal in the future