Skip to content

fix(create-vite): error on invalid template in non-interactive mode#22836

Draft
CoderSilicon wants to merge 2 commits into
vitejs:mainfrom
CoderSilicon:fix/create-vite-silent-fallback
Draft

fix(create-vite): error on invalid template in non-interactive mode#22836
CoderSilicon wants to merge 2 commits into
vitejs:mainfrom
CoderSilicon:fix/create-vite-silent-fallback

Conversation

@CoderSilicon

Copy link
Copy Markdown

Description

Currently, when running create-vite in non-interactive mode (e.g., via a CI/CD script or passing --no-interactive), providing an invalid template name via the --template flag results in a silent fallback to vanilla-ts. This can mask typos or automation configuration errors, thus creating an unexpected project blueprint without warning.

This PR adds an explicit check for invalid user-supplied templates when interactive mode is disabled. If an invalid template is detected, the Output now logs an error message listing the valid template keys and exits with a status code of 1.

Related Issues

This was discovered while auditing the non-interactive workflow configuration logic in packages/create-vite/src/index.ts.

Alternatives Explored

  • Keeping the fallback but logging a warning message: Rejected because automation tools usually depend on strict failures to catch configuration mistakes early.

Reviewer Notes

The changes are isolated entirely to the template resolution logic within init().

@sapphi-red

Copy link
Copy Markdown
Member

The lint CI is failing

@sapphi-red
sapphi-red marked this pull request as draft July 2, 2026 02:15
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.

2 participants