Skip to content

Breaking behavior due to enhanced-resolve 5.21.0 #567

@sriramyepuganti

Description

@sriramyepuganti

📖 Description

webpack@5 depends on enhanced-resolve using a semver range (^5.x.x).

After upgrading (via fresh install / lockfile update), enhanced-resolve@5.21.0 gets installed, which introduces a breaking change in resolveContext.stack.

This breaks existing webpack plugins relying on resolver hooks.


🔁 Where the issue occurs

Custom plugin using:

resolver.hooks.resolved.tapAsync(
  pluginName,
  async (originalResolved, resolveContext, callback) => {
    // depends on resolveContext.stack
    callback();
  }
);

Behavior with enhanced-resolve 5.20.0

  • resolveContext.stack is a Set
  • Iterable and stable
  • Works correctly for deduplication logic

Behavior with enhanced-resolve 5.21.0

resolveContext.stack is now an object:

{
  parent: {},
  path: '',
  module: true | false
}

⚠️ Issues Observed

  • Breaking change in structure
    • Set → Object
    • Not iterable → breaks existing plugins
    • Inconsistent resolution metadata
  • module flag missing or incorrect in some cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions