Skip to content

Regression in 5.109.0: resolve.alias mapping to an absolute path that points at a package directory no longer resolves #21541

Description

@GregOriol

Have you used AI?

Yes

Bug Description

Using resolve.alias to make an alias to an absolute path of a package inside node_modules, webpack 5.109.0+ fails to resolve the package with the following error:

Module not found: Error: Can't resolve 'vendor/tippy.js'

This worked in 5.108.4

Link to Minimal Reproduction and step to reproduce

// webpack.config.js
const path = require('path');
module.exports = {
  mode: 'development',
  entry: './index.js',
  resolve: {
    alias: { vendor: path.resolve(__dirname, 'node_modules') },
  },
};

// index.js
import('vendor/tippy.js');

Build with webpack 5.109.0/5.109.1 → can't resolve 'vendor/tippy.js' error
Build with webpack 5.108.4 → succeeds

Expected Behavior

vendor/tippy.js should resolve using the configured alias to <abs>/node_modules/tippy.js as it did in 5.108.4

Actual Behavior

Can't resolve error

Environment

- Webpack: first-bad at 5.109.0 (also bad at 5.109.1); last-good 5.108.4
- enhanced-resolve: 5.24.3 (identical on both)
- Node.js: v24.18.0 and v26.5.0
- OS: macOS (darwin)
- verified by installing 5.108.4 / 5.109.0 / 5.109.1 side-by-side and running the same config + entry against each

Is this a regression?

Yes (please specify version below)

Last Working Version

5.108.4

Additional Context

Investigated with the help of claude, reviewed humanly before posting

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo