Feature Request: TC39 Stage 3 import defer
Proposal repo: https://github.com/tc39/proposal-defer-import-eval
The new import defer syntax is at Stage 3 in the TC39 process and implementations are starting to move forward in browsers and tools.
This enables new optimizations in code splitting builds that avoid unnecessary code execution.
Example:
import defer * as mod from './mod.js';
export function lazyModUser () {
mod.foo();
}
where mod is a "Deferred Module" flavor of Module Namespace, whose accessors (including e.g. reading keys) cause evaluation to run.
Desired support
At a minimum the syntax should be tolerated. Ideally this should be a fully compliant downlevel as that will benefit users the most. That requires function-wrapping the modules that will be lazily evaluated, i.e. they cannot be inlined (scope-hoisted).
References
Feature Request: TC39 Stage 3
import deferProposal repo: https://github.com/tc39/proposal-defer-import-eval
The new import defer syntax is at Stage 3 in the TC39 process and implementations are starting to move forward in browsers and tools.
This enables new optimizations in code splitting builds that avoid unnecessary code execution.
Example:
where
modis a "Deferred Module" flavor of Module Namespace, whose accessors (including e.g. reading keys) cause evaluation to run.Desired support
At a minimum the syntax should be tolerated. Ideally this should be a fully compliant downlevel as that will benefit users the most. That requires function-wrapping the modules that will be lazily evaluated, i.e. they cannot be inlined (scope-hoisted).
References
import deferproposal is Stage 3