You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
console vite/vitest configs rely on features configLoader: 'native' drops — a future Vite major turns 5 warnings into a broken config load #3384
Found while working #3305 (wiring apps/console/tsconfig.node.json into a gate). Not fixed there — orthogonal to that change, filing per PD #10. Deliberately left unassigned.
What
Every vite build / vitest run touching the console prints this, once per config load (so it repeats several times in one test run):
(!) Your Vite config uses features that are unsupported by `configLoader: 'native'`,
which is planned to become the default in a future major version of Vite:
- `__dirname` (vitest.config.ts:13:33). Use `import.meta.dirname` instead
- import "./vite.config" without a file extension (vitest.config.ts:4:24). Add the file extension
- `__dirname` (vite.config.ts:56:35). Use `import.meta.dirname` instead
- import "../../scripts/vite-crypto-stub" without a file extension (vite.config.ts:6:32). Add the file extension
- import "../../scripts/vite-maplibre-worker" without a file extension (vite.config.ts:7:36). Add the file extension
Two distinct incompatibilities, both in apps/console:
__dirname in an ESM config — apps/console/vitest.config.ts and apps/console/vite.config.ts. Vite's current (bundling) loader injects a CJS-ish shim; the native loader will not. Replacement is import.meta.dirname.
Extensionless relative imports — vitest.config.ts imports ./vite.config, and vite.config.ts imports ../../scripts/vite-crypto-stub / ../../scripts/vite-maplibre-worker. Node's native ESM resolver does not do extension guessing.
(Line numbers above are from origin/main. On #3305's branch the two scripts/ imports shift to 10/11 because a comment was added above them — the imports themselves are untouched.)
Why it matters
This is dormant today — it is only a warning, and everything builds and tests green, which is why this is filed as a finding rather than a defect. What makes it worth recording is the failure mode when Vite flips the default: the console's config would fail to load, so vite build, vite dev, and the console's whole vitest project all die at once, on a dependency bump rather than on a code change. The fix is mechanical and can be done at any time; the cost of discovering it during an upgrade is a blocked upgrade.
There is also a mild interaction with #3305: apps/console/tsconfig.node.json now type-checks vite.config.tsand the scripts/vite-*.ts plugins, so whoever adds the file extensions has a gate that will confirm the specifiers still resolve. moduleResolution: "bundler" accepts both spellings, so adding .ts extensions there will not upset the type-check either way.
Suggested direction (not decided)
__dirname -> import.meta.dirname in both console configs.
Add explicit extensions to the three relative config imports.
Optionally set configLoader: 'native' explicitly afterwards so the repo pins the behaviour instead of waiting to inherit it, and any regression shows up immediately rather than at the next Vite major.
Activity
yinlianghui commentedon Aug 6, 2026
发现分诊轮(晋级):摘
finding换pm:queue。前提复核 live 且在恶化(__dirname用点已增至 8+):今天每次构建都在刷警告,机械修;拖到 Vite 升版时才发现就是阻塞项。文件面apps/console/vite.config.ts+vitest.config.ts。Generated by Claude Code
yinlianghui commentedon Aug 6, 2026
认领:objectui 分片 PM 并行批第 49 单
会话:
session_01GTRjn8xBqp75dk7kFupVRt分支:
claude/issue-3384-console-config-nativeWorktree:
objectui-issue-3384文件面:
apps/console/vite.config.ts、apps/console/vitest.config.ts(__dirname→import.meta.dirname、三处相对导入补扩展名)。issue 的可选项采纳:改完显式钉configLoader: 'native',让回归立刻响而不是等下个 Vite 大版本(若钉上后有实际不兼容,回报为发现,不硬钉)。#3305 接好的 tsconfig.node.json 门用于确认 specifier 仍解析。与同批第 50 单(同 app 不同文件:preview-samples.ts)已声明互斥。
Generated by Claude Code
yinlianghui commentedon Aug 6, 2026
验收:ACCEPT → PR #3475(并行批第 49 单 + 续作,会话
session_01GTRjn8xBqp75dk7kFupVRt),17/17 检查零失败(Type Check 于伴随修正后转绿;Build & E2E + Bundle Analysis 绿证明 console 真实vite build在新配置下通过,不只是能加载)。ready + auto-merge 因 GraphQL 配额排队,恢复即执行。复核要点:
__dirname,「5 处警告」实为 39 处改动),dev 用双向证据钉住;两种 loader 下 resolveConfig 输出等价的对照做得扎实。.ts扩展名需要allowImportingTsExtensions——issue 前提「bundler 双拼写皆可」为假)经围栏放宽后以实测三选一(noEmit 被 TS6310 挡、rewrite 语义多余、emitDeclarationOnly 干净)落地;pin 裁定因结构性不可执行(configLoader 是 InlineConfig 入参,鸡生蛋)由 PM 撤回,dev 的部分缓解论证(零警告态即绊线)成立。includelists a file that doesn't exist #3476(vitest.config.ts 在零 tsc 程序内)finding 留池;包内三处同款 extensionless 模式(components/plugin-dashboard/fields)按 dev 建议留作后续横扫候选,记于此不另立单。Generated by Claude Code