npm / enhanced-resolve
enhanced-resolve
What changed in enhanced-resolve 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
10 breaking1 security17 new APIs and options8 performance12 behavior and defaults40 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initenhanced-resolve 588 changes
Breaking changes 10
Stack entries now declare name as string | undefined rather than as an optional property.
Resolution no longer falls back to a parent node_modules when an exports target file is not found.
Non-relative imports targets such as #a pointing to #b no longer re-enter imports resolution, matching Node.js ESM behavior.
CacheFileSystem allows only synchronous usage and supports a second options argument for all methods.
The context property is removed from the Node API.
A real filesystem can be used without providing join, following the removal of memory-fs.
The loader property is removed from the Node API.
The minimum supported Node.js version increases, affecting which runtimes can run this release.
module/ now resolves to a directory rather than to module.js as a file.
NodeJsInputFileSystem is removed.
Security 1
Fixes a bypass where an in-root symlink points outside the root, allowing it to evade restrictions.
New APIs and options 17
Adds readdirPrefix so purge with exact: true still removes cached directory listings below what.
The UnsafeCache type of the unsafeCache option is now exported for use by developers.
Exposes the resolved package as packageId and accepts it as context.packageId, allowing unambiguous resolution when package entries share a URL.
Accepts a second options argument with exact; when true, removes only entries whose key exactly matches what instead of entries whose key starts with what.
When true, extensionAlias also applies to paths resolved through the package.json exports field; it is off by default to match Node.js.
A promise API was added, and resolution can be performed without context and resolveContext.
The
baseUrloption can override the tsconfig.json'sbaseUrl.Added TsconfigPathsPlugin as a replacement for tsconfig-paths-webpack-plugin.
The conditionNames option is added as part of support for the package.json exports field.
The exportsFields option is added as part of support for the package.json exports field.
The fallback option works like alias but activates only when normal resolving fails.
Fragment support is added.
The fullySpecified option is added for better Node.js ESM compatibility.
Support is added for the imports field in package.json.
The restrictions option limits the paths that are allowed to resolve.
The roots option is added.
Yarn Plug’n’Play resolution is supported, and PnP tracks dependency to the .pnp.js file.
Performance 8
Reduces hot-path allocations in the resolve pipeline.
Alias resolution is faster on the hot path, especially for alias-heavy configurations.
Optimizes path checks, context scanning, matching, cache checks, hot paths, and per-resolve allocations.
JSON comment stripping and parsing results are cached, avoiding redundant work when resolving tsconfig.json files and improving TsconfigPathsPlugin warm performance.
Performance of many plugins was improved.
Improves resolver cache hit rate, which may improve resolution performance.
Optimizes TsconfigPathsPlugin, which may improve resolution performance for projects using it.
The number of filesystem accesses is optimized and reduced by serializing all operations.
Behavior and default changes 12
Options and the context path now accept file: URL strings wherever a path is accepted.
The resolver works in browsers, Deno, and Bun as well as Node; browser use requires supplying your own fileSystem.
The context path and request arguments of resolve, resolveSync, and resolvePromise accept file: URL instances, which are converted to filesystem paths; plain strings remain literal paths.
Path-like resolve options roots, modules, alias/fallback targets, restrictions, and tsconfig settings now accept file URL instances and convert them to filesystem paths; plain strings remain literal paths.
TsconfigPathsPlugin now supports extending from unscoped npm packages.
Comments in JSONC-formatted tsconfig.json files are supported.
JSONC parsing now supports trailing commas.
The resolver now handles the file: schema.
Alias values can now be arrays.
An alias value of false is supported, allowing an entry such as alias: { something: false }.
Dependencies are tracked while resolving, including the .pnp.js file for Yarn PnP.
Self reference resolving is supported when the package.json exports field is present.
Fixes and other changes 40
An inherited baseUrl substitutes ${configDir}, and an empty baseUrl is treated as the directory of its tsconfig, like tsc.
tsconfig extends resolution now follows tsc, including package exports.
Inherited paths without a baseUrl are resolved relative to the tsconfig that declares them.
Extending a tsconfig no longer changes it for later loads that share the file system cache.
File system types now accept fs typed by @types/node 26.
Failed resolution now diagnoses exports or imports fields that place subpaths inside conditions, naming offending keys and showing the supported arrangement; field-processing errors also name their package.json.
The object form of Plugin no longer types apply with this: Resolver, matching its runtime call where this is the plugin.
Reads a file: URL the way Node does when parsing a request.
Discovery now soft-fails when it loads a broken tsconfig, rather than failing outright.
Relative paths in tsconfig extends remain relative.
Keeps the original request resolvable when extensionAlias lists its own extension.
Fixes string restriction boundary checks and normalizes comparisons, including Windows path matching; the same comparison backs tsconfig path matching.
Treats UNC paths as Windows paths, applying path.win32 semantics for normalization, joining, and walking up instead of treating them as bare module requests.
Resolves tsconfig extends package specifiers from ancestor node_modules directories, supporting workspace hoisting.
Callbacks from one synchronous burst are batched into a single tick.
When a package exports target is filtered out by restrictions, resolution falls back to the next modules entry instead of throwing.
No longer adds configDir to modules when tsconfig has no baseUrl, avoiding an unintended change to module resolution.
When tsconfig: true is used, enhanced-resolve walks up parent directories to find tsconfig.json, matching TypeScript's own findConfigFile behavior.
When a
pathspattern matches but its mapped path does not exist, resolution falls through to normal module resolution, allowing packages such as@sentry/reactto resolve fromnode_modules.Fixes circular project references that could cause a stack overflow.
Restores compatibility with plugin iteration using [...resolveContext.stack].
Supports resolveSync when useSyncFileSystemCalls is enabled.
Avoids out-of-memory behavior when duration is Infinity.
DOS device paths such as \\?\… and \\.\… are now handled properly.
The extensionAlias option now applies to the imports field to align with TypeScript resolution.
Fixed behavior when tsconfig: true is used and no default tsconfig.json file exists.
Fixes extends resolution bugs in TsconfigPathsPlugin.
Circular
extendsin tsconfig.json is detected to prevent an infinite loop.Subpath imports that start with #/ are now allowed.
Duplicate entries in aliasFields are deduplicated.
Duplicate entries in descriptionFiles are deduplicated.
Duplicate entries in extensions are deduplicated.
A bug involving lowercase file letters is fixed.
The crash caused by setting main to "." is fixed.
Duplicate entries in mainFields are deduplicated.
Duplicate entries in mainFiles are deduplicated.
Duplicate entries in modules are deduplicated.
A bug where a same-named file in the modules file was resolved instead of the package is fixed.
Purging of readdir is fixed.
Handling of scoped packages is improved.