getVitestConfigFromNuxt returns empty viteConfig on Nuxt 4.6 + Vite 8 (rolldown) — nuxt environment tests fail with Missing "#app/..." specifier
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
- 領域
- build-system, testing
調査の方向性
Start with getVitestConfigFromNuxt and startNuxtAndGetViteConfig in @nuxt/test-utils (config.mjs), which capture the config through the vite:configResolved hook. Run the repro script from the issue against a Nuxt 4.6 fixture to confirm the captured config is empty, then check how Nuxt's Vite 8 builder now exposes per-environment configs. Done when viteConfig.resolve.alias contains #app and #build, and a trivial nuxt environment test imports successfully.
索引モデルが issue の本文から書いたものです。
説明
Environment
- Nuxt: 4.6.0
- Vite: 8.3.4 (rolldown-vite)
- Vitest: 4.1.11
- @nuxt/test-utils: 4.3.4 (latest; also reproduced on 4.3.2)
- Node: 22.23.4
- OS: Linux
Description
On Nuxt 4.6 + Vite 8 (rolldown), getVitestConfigFromNuxt captures an empty object as the Vite config. As a result, #app/#build aliases and Nuxt's virtual-module plugins are never registered in the test Vite server, and every test file using the nuxt environment fails at import time:
Error: Missing "#app/composables/router" specifier in "@nuxt/test-utils" package
Plugin: vite:import-analysis
(#app/... falls through to package-imports resolution of @nuxt/test-utils because no alias matched.)
Minimal reproduction
// repro.mjs — run from any Nuxt 4.6 project root
const mod = await import('@nuxt/test-utils/dist/config.mjs')
const cfg = await mod.getVitestConfigFromNuxt(undefined, { overrides: { rootDir: process.cwd() } })
console.log('viteConfig keys:', Object.keys(cfg.viteConfig || {}))
console.log('resolve.alias present:', !!cfg.viteConfig?.resolve?.alias)
Expected: viteConfig contains Nuxt's client Vite config, including resolve.alias with #app, #build, ~, etc.
Actual:
viteConfig keys: []
resolve.alias present: false
Also reproduced with nitroEnvironment: true, and with both the app root and a minimal fixture (rootDir override). Reproduced with any trivial nuxt environment test file, e.g.:
// test/probe.test.ts
import { it } from 'vitest'
import { useNuxtApp } from '#app'
it('probe', () => { console.log(Object.keys(useNuxtApp())) })
// vitest.config.ts
import { defineVitestConfig } from '@nuxt/test-utils/config'
export default defineVitestConfig({ test: {} })
Analysis
getVitestConfigFromNuxt captures the config via the vite:configResolved hook (startNuxtAndGetViteConfig). With Nuxt 4.6's Vite 8 builder (@nuxt/vite-builder), the hook fires but the captured config has zero keys. Nuxt 4.6's builder now constructs per-environment configs (environments.client / environments.ssr, see vite-builder clientEnvironment() and the strippedConfig hook invocation in the build path), so the top-level Vite config shape test-utils expects appears to have moved.
Happy to provide more diagnostics if useful.
- 主要言語
- TypeScript
- スター
- 445
- フォーク
- 121
- 平均マージ
- 3日 11時間
- マージ済み PR(30日)
- 23
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nuxt/test-utils のほかの issue
-
nuxt environment: `fetch(new Request(url))` fails with `Failed to parse URL from [object Request]`対応中かも @yamachi4416 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
nuxt/test-utils#1891 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
nuxt/test-utils#1889 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
pending triage
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
nuxt/test-utils#1671 · コメント 5 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
pending triage
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
nuxt/test-utils#1607 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
`@vitest-environment-options` is not working対応中かも @yamachi4416 が 210 日前に担当しました。 オープンpending triage
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
nuxt/test-utils#1541 · リアクション 2 件 ·
メンテナーはふだん 2 日以内に返信
nuxt/test-utils の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Search input loses focus while typing on the Inventory, Reservations and Locations lists (view_configurations enabled)対応中かも @medusa-os-bot が今日担当しました。 オープンstatus: needs triaging type: bug version: 2.0
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
medusajs/medusa#17886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
marimo-team/marimo#11949 ·
メンテナーはふだん 1 日以内に返信
-
bug server-time v2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/servers#5559 ·
メンテナーはふだん 1 日以内に返信
-
D1 Time Travel restore help advertises 30 days without a plan qualifier対応中かも @akhil9tiet が今日担当しました。 オープンbug package:wrangler product:d1
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
cloudflare/workers-sdk#17000 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信