Skip to content

Fix Vite alias matching for next/* imports - #29

Merged
DavidAlexandre93 merged 1 commit into
mainfrom
codex/fix-build-error-in-vite
Mar 7, 2026
Merged

Fix Vite alias matching for next/* imports#29
DavidAlexandre93 merged 1 commit into
mainfrom
codex/fix-build-error-in-vite

Conversation

@DavidAlexandre93

Copy link
Copy Markdown
Owner

Motivation

  • The production build failed because the generic next alias captured subpath imports like next/script, resolving to an incorrect path such as src/shims/next/index.ts/script.
  • The goal is to ensure next/* subpath imports resolve to their explicit shims while keeping the base next shim available for exact matches.

Description

  • Replaced the object-form resolve.alias with an ordered array of alias entries in vite.config.ts so more specific aliases are matched first.
  • Added an exact-match alias { find: /^next$/, replacement: path.resolve(__dirname, "src/shims/next/index.ts") } so next no longer captures next/* imports.
  • Kept explicit aliases for next/* and next-i18next/* shims to preserve existing behavior for those subpaths.

Testing

  • Ran npm run build, which could not complete in this environment because vite is not installed locally and the command failed.
  • Ran npm install to restore dependencies, which failed due to 403 Forbidden from the npm registry, preventing a full validation of the production build.

Codex Task

@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 8 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/david-alexandre-fernandes-projects?upgradeToPro=build-rate-limit

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@DavidAlexandre93
DavidAlexandre93 merged commit a64705c into main Mar 7, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant