Detect every name Vite resolves its config from - #679
Merged
Conversation
`PathSet#vite?` decides whether an application was generated with the
Vite-based blueprint by looking for a configuration file at its root, and it
looked for three names: `vite.config.mjs`, `vite.config.js` and
`vite.config.ts`. Vite resolves its configuration from six, adding
`vite.config.cjs`, `vite.config.mts` and `vite.config.cts`.
An application configured in one of the three missing names was therefore
taken for a classic one. In `development` that means `ember build --watch`,
which a Vite-based project refuses:
:frontend has failed to build: The `--watch` option to `ember build` is
not supported in Vite-based projects. Please use `vite dev` instead.
Name the full set in `VITE_CONFIG_FILES` and check against it, so the six
stay together and the specs cover whichever the list holds.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PathSet#vite?decides whether an application came from the Vite-based blueprint by looking for a configuration file at its root, and it looked for three names:Vite resolves its configuration from six. Taken from the resolver in
vite@8.2.2:So an application configured in
vite.config.mts,vite.config.ctsorvite.config.cjswas taken for a classic one.What that costs
In
developmenta classic application is served byember build --watch, which a Vite-based project refuses. Renaming the config of anember-cli7.2.0 application tovite.config.mtsand asking the gem about it, before this change:and the first request then fails with:
After this change, the same application:
The change
The six names live in
PathSet::VITE_CONFIG_FILES, andvite?checks against it. The specs iterate that constant, so a name added to the list is covered without a new example being written for it.Tests
bin/rspec spec/lib/ember_cli/path_set_spec.rb— 55 examples, 0 failuresbin/rspec spec/lib— 2 failures, both (app_spec.rb:192,app_spec.rb:200) failing identically onmain; they neednode_modulesinstalled to find theemberbinary🤖 Generated with Claude Code