You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1879116
Browse filesBrowse the repository at this point in the historyBrowse files
feat: resolve imported ESM bindings by name in a debugger
Imported bindings compile to a namespace read, so a debugger's console
and watch expressions cannot resolve the name the source uses (#3957).
Two complementary halves, both semantics-preserving:
`optimization.localImportBindings` (on in development) declares a real
local variable for an imported name wherever that is observationally
equal to the live binding: a namespace object, whose identity never
changes, and a named import of a top-level `const` or an `export
default` expression, which the language pins to one value. A module read
from inside its own evaluation cycle, or accepted by `module.hot.accept`
(where an update re-runs the import statement rather than the module
body), keeps reading through the namespace.
A `-scopes` devtool suffix emits the ECMA-426 "Scopes" field, naming for
every remaining binding the generated expression it reads. It changes no
emitted code and costs bytes only in the map.
* Creates a module-internal dependency graph for top level symbols, exports and imports, to improve unused exports detection.
2330
2330
*/
2331
2331
innerGraph?: boolean;
2332
+
/**
2333
+
* Read an imported ESM binding into a local variable of the same name wherever that is observationally equal to the live binding, so a debugger resolves it under the name the source uses.
2334
+
* @since 5.111.0
2335
+
*/
2336
+
localImportBindings?: boolean;
2332
2337
/**
2333
2338
* Rename exports when possible to generate shorter code (depends on optimization.usedExports and optimization.providedExports, true/"deterministic": generate short deterministic names optimized for caching, "size": generate the shortest possible names).
* Creates a module-internal dependency graph for top level symbols, exports and imports, to improve unused exports detection.
5021
5026
*/
5022
5027
innerGraph?: boolean;
5028
+
/**
5029
+
* Read an imported ESM binding into a local variable of the same name wherever that is observationally equal to the live binding, so a debugger resolves it under the name the source uses.
5030
+
* @since 5.111.0
5031
+
*/
5032
+
localImportBindings?: boolean;
5023
5033
/**
5024
5034
* Rename exports when possible to generate shorter code (depends on optimization.usedExports and optimization.providedExports, true/"deterministic": generate short deterministic names optimized for caching, "size": generate the shortest possible names).
* Provide a custom public path for the SourceMapping comment.
79
79
*/
80
80
publicPath?: string;
81
+
/**
82
+
* Emit the 'scopes' field, which tells a debugger the generated expression each imported ESM binding reads, so it resolves under the name the source uses.
83
+
* @since 5.111.0
84
+
*/
85
+
scopes?: boolean;
81
86
/**
82
87
* Provide a custom value for the 'sourceRoot' property in the SourceMap.
* @property {Map<string, string>=} importBindings what each imported binding of the current module reads, by its name in the source, for the source map `scopes` field
0 commit comments