Skip to content

fix(webpack): bump enhanced-resolve to 5.18.4 for #/ subpath imports - #95445

Open
controversial wants to merge 1 commit into
vercel:canaryfrom
controversial:codex/enhanced-resolve-subpath-slash
Open

controversial wants to merge 1 commit into
vercel:canaryfrom
controversial:codex/enhanced-resolve-subpath-slash

Conversation

@controversial

@controversial controversial commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

[NOTE: claude-authored, i have verified the tests & reviewed the diff]

What?

Follow-up to #94461 to enable the identical behavior in Webpack by bumping enhanced-resolve by one patch version (5.18.3 → 5.18.4)

Fixes Webpack failing to resolve imports using the common "#/*": "./src/*" pattern in package.json imports field.

Bumps the vendored enhanced-resolve to 5.18.4 (via pnpm.overrides, alongside the existing webpack pin) and recompiles packages/next/src/compiled/webpack/bundle5.js. Adds an e2e test covering "imports": { "#/*": "./src/*" } for both the app package and an external package.

Why?

Brings resolution behavior to parity with

enhanced-resolve picked this up in webpack/enhanced-resolve#468 (v5.18.4), but Next.js still vendors 5.18.3, so next dev --webpack / next build --webpack reject import x from "#/foo" with Package import specifier "#/foo" is not defined / should not start with "#/".

How?

  • Add "enhanced-resolve": "5.18.4" to pnpm.overrides (webpack@5.98.0 depends on ^5.17.1, so this stays in-range)
  • Regenerate bundle5.js via taskr ncc_webpack_bundle5 + ncc_webpack_bundle_packages
  • New test/e2e/app-dir/subpath-imports-slash fixture:
    • App package.json with "imports": { "#/*": "./src/*" }, page imports #/greeting
    • node_modules/external-slash-pkg with its own "#/*": "./lib/*", forced through the bundler via transpilePackages
    • typescript.ignoreBuildErrors: true so the auto-generated tsconfig (no paths) does not add a JsConfigPathsPlugin alias that would mask the imports-field resolution under test

Follow-up to #94461
Refs #94290

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant