`vp` doesn't resolve `vite.config.ts` with `--conditions` flag
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 67/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bun, node.js, typescript
- 領域
- build-system, cli, tooling
調査の方向性
リンクされた再現手順を使用し、bun run build の前後で bun run lint を実行してください。失敗するエントリポイントは NODE_OPTIONS=--conditions=dev を指定した vp lint です。vite.config.ts から設定の読み込みとパッケージ解決を追跡し、dev の export condition が dist/ を必要とせずに TypeScript ソースを解決すること、そして lint が正常に完了することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
I am doing
A package whose exports map has a dev condition pointing at TypeScript sources, and whose vite.config.ts imports the package by its own name (@scope/thing/rules). Running vp lint with the condition passed via NODE_OPTIONS=--conditions=dev, since vp has no --conditions flag of its own.
What I expect
vp resolves @scope/thing/rules through the dev condition to ./src/rules.ts, so the config loads from sources. Node resolves it that way with --conditions=dev, and tsc does with customConditions: ["dev"].
What is actually happening
The condition is ignored. Resolution falls through to default, ./dist/rules.js. With no dist/ built, that file doesn't exist, so the import is reported unresolved and marked external. Being external, it is then imported at runtime from node_modules/.vite-temp/, where Node's package scope lookup stops at the node_modules segment and the self-reference cannot resolve, so config loading fails outright.
It emits the following error
$ NODE_OPTIONS=--conditions=dev vp lint
vite.config.ts (1:361) [UNRESOLVED_IMPORT] Could not resolve '@scope/thing/rules' in vite.config.ts
╭─[ vite.config.ts:1:362 ]
│
1 │ const __vite_injected_original_dirname = "$PWD/vite-plus-dev-config";const __vite_injected_original_filename = "$PWD/vite-plus-dev-config/vite.config.ts";const __vite_injected_original_import_meta_url = "file://$PWD/vite-plus-dev-config/vite.config.ts";import rules from "@scope/thing/rules";
│ ──────────┬─────────
│ ╰─────────── Module not found, treating it as an external dependency
───╯
failed to load config from $PWD/vite-plus-dev-config/vite.config.ts
[Vite+] resolve universal vite config error: Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@scope/thing' imported from $PWD/vite-plus-dev-config/node_modules/.vite-temp/vite.config.ts.timestamp-1787978765772-966599996ab688.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:301:9)
at packageResolve (node:internal/modules/esm/resolve:784:25)
at moduleResolve (node:internal/modules/esm/resolve:873:18)
at defaultResolve (node:internal/modules/esm/resolve:1006:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:708:20)
at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:728:38)
at ModuleLoader.resolveSync (node:internal/modules/esm/loader:766:56)
at #resolve (node:internal/modules/esm/loader:690:17)
at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:610:35)
at ModuleJob.syncLink (node:internal/modules/esm/module_job:277:33) {
code: 'ERR_MODULE_NOT_FOUND'
}
error: Failed to resolve vite config: GenericFailure, Cannot find package '@scope/thing' imported from $PWD/vite-plus-dev-config/node_modules/.vite-temp/vite.config.ts.timestamp-1787978765772-966599996ab688.mjs
error: script "lint" exited with code 1
Running bun run build first makes dist/rules.js exist and vp lint passes, which shows resolution itself works and only the condition is missing.
Reproduction
https://github.com/ryansuhartanto/vite-plus-dev-config
Steps to reproduce
$ bun install
$ bun run lint # Fail
$ bun run build
$ bun run lint # Now succeed
System Info
Local vite-plus:
vite-plus v0.3.0
Tools:
vite v8.2.2
rolldown v1.2.5
vitest v4.1.11
oxfmt v0.64.0
oxlint v1.79.0
oxlint-tsgolint v7.0.2001
tsdown v0.22.14
Used Package Manager
bun
Logs
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
- 主要言語
- Rust
- スター
- 5.8k
- フォーク
- 263
- 平均マージ
- 22時間 44分
- マージ済み PR(30日)
- 134
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/vite-plus のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
voidzero-dev/vite-plus#2097 · コメント 10 件 · リアクション 2 件 ·
-
bug enhancement
voidzero-dev/vite-plus#2746 · コメント 3 件 · リアクション 1 件 · 担当者 1 名 ·
-
pending triage
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
voidzero-dev/vite-plus#2735 ·
-
voidzero-dev/vite-plus#2728 · コメント 1 件 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
voidzero-dev/vite-plus#2703 · 担当者 1 名 ·
voidzero-dev/vite-plus の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100