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 3658eca
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.
2323
2323
*/
2324
2324
innerGraph?: boolean;
2325
+
/**
2326
+
* 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.
2327
+
* @since 5.111.0
2328
+
*/
2329
+
localImportBindings?: boolean;
2325
2330
/**
2326
2331
* 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.
4910
4915
*/
4911
4916
innerGraph?: boolean;
4917
+
/**
4918
+
* 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.
4919
+
* @since 5.111.0
4920
+
*/
4921
+
localImportBindings?: boolean;
4912
4922
/**
4913
4923
* 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