Skip to content

Detect every name Vite resolves its config from - #679

Merged
tricknotes merged 1 commit into
mainfrom
detect-every-vite-config-name
Sep 11, 2026
Merged

Detect every name Vite resolves its config from#679
tricknotes merged 1 commit into
mainfrom
detect-every-vite-config-name

Conversation

@tricknotes

@tricknotes tricknotes commented Sep 11, 2026

Copy link
Copy Markdown
Owner

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:

%w[vite.config.mjs vite.config.js vite.config.ts]

Vite resolves its configuration from six. Taken from the resolver in vite@8.2.2:

vite.config.cjs  vite.config.cts  vite.config.js
vite.config.mjs  vite.config.mts  vite.config.ts

So an application configured in vite.config.mts, vite.config.cts or vite.config.cjs was taken for a classic one.

What that costs

In development a classic application is served by ember build --watch, which a Vite-based project refuses. Renaming the config of an ember-cli 7.2.0 application to vite.config.mts and asking the gem about it, before this change:

config: ["vite.config.mts"]
paths.vite? => false
dev_server? => false

and the first request then fails with:

:frontend has failed to build: The `--watch` option to `ember build` is not
supported in Vite-based projects. Please use `vite dev` instead.

After this change, the same application:

config: ["vite.config.mts"]
paths.vite? => true
dev_server? => true

The change

The six names live in PathSet::VITE_CONFIG_FILES, and vite? 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 failures
  • bin/rspec spec/lib — 2 failures, both (app_spec.rb:192, app_spec.rb:200) failing identically on main; they need node_modules installed to find the ember binary

🤖 Generated with Claude Code

`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>
@tricknotes
tricknotes marked this pull request as ready for review September 11, 2026 16:44
@tricknotes
tricknotes merged commit fe427f1 into main Sep 11, 2026
16 checks passed
@tricknotes
tricknotes deleted the detect-every-vite-config-name branch September 11, 2026 16:44
@tricknotes tricknotes mentioned this pull request Sep 11, 2026
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