Skip to content

refactor(cli): proxy dev and build to Vite - #3380

Draft
james-elicx wants to merge 27 commits into
codex/vite-dev-lifecyclefrom
codex/thin-vinext-proxies
Draft

james-elicx wants to merge 27 commits into
codex/vite-dev-lifecyclefrom
codex/thin-vinext-proxies

Conversation

@james-elicx

@james-elicx james-elicx commented Sep 22, 2026

Copy link
Copy Markdown
Member

Summary

  • replace vinext dev and vinext build orchestration with in-process project-local Vite CLI delegation
  • retain only an actionable missing-config preflight, including option-aware positional roots
  • delete wrapper-owned lifecycle, logging, help, and obsolete build/dev argument parsing

Deliberate interface changes

Configless use now asks users to run vinext init. Vinext-only build flags move to vinext plugin configuration; shared Vite flags pass through unchanged.

Two pre-config wrapper behaviors cannot be preserved while these commands remain thin Vite proxies and direct Vite behaves identically:

  • Older configured CommonJS projects without an ESM package boundary need a one-time vinext init migration. The alias no longer edits package/config files before Vite loads them.
  • Static dependencies of a Vite config can no longer rely on the old wrapper loading .env before evaluation. Config-time values should be loaded explicitly with Vite loadEnv(mode, process.cwd(), ""); see the README for custom envDir guidance.

Both compatibility tradeoffs have open review threads for maintainer decision. They are not claimed as behavior-preserving.

Validation

  • packed proxy, signal, lock, and command contract tests
  • vp check
  • vp run vinext#build

PR 6 of 7.

@james-elicx
james-elicx added this pull request to stack #3382 September 22, 2026 11:37
@pkg-pr-new

pkg-pr-new Bot commented Sep 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@3380

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@3380

@vinext/types

npm i https://pkg.pr.new/@vinext/types@3380

vinext

npm i https://pkg.pr.new/vinext@3380

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@3380

commit: decd15e

@james-elicx james-elicx changed the title codex/thin vinext proxies refactor(cli): proxy dev and build to Vite Sep 22, 2026
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues\n\nTime limit: 8 minutes. Complete the review and post all findings within that limit.

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
workers-cache preview production
kv preview production
static-export preview production
web preview production

Comment thread packages/vinext/src/cli.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx
james-elicx force-pushed the codex/thin-vinext-proxies branch from 4597370 to dd4f40d Compare September 22, 2026 11:51
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues\n\nTime limit: 8 minutes. Complete the review and post all findings within that limit.

Comment thread packages/vinext/src/cli.ts
Comment thread packages/vinext/src/cli.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 2 actionable inline findings.

github run

@james-elicx
james-elicx force-pushed the codex/thin-vinext-proxies branch from dd4f40d to b422b40 Compare September 22, 2026 12:16
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Time limit: 8 minutes. Complete the review and post all findings within that limit.

Comment thread packages/vinext/src/cli.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx
james-elicx force-pushed the codex/thin-vinext-proxies branch from b422b40 to 11dbc58 Compare September 22, 2026 12:39
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues\n\nTime limit: 8 minutes. Complete the review and post all findings within that limit.

Comment thread packages/vinext/src/cli.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx
james-elicx force-pushed the codex/thin-vinext-proxies branch from e75c601 to 2b85ee3 Compare September 22, 2026 12:44
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues\n\nTime limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx
james-elicx force-pushed the codex/thin-vinext-proxies branch from 2b85ee3 to 4473a51 Compare September 22, 2026 12:48
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues\n\nTime limit: 8 minutes. Complete the review and post all findings within that limit.

Comment thread packages/vinext/src/cli.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx
james-elicx force-pushed the codex/thin-vinext-proxies branch from 3b63168 to decd15e Compare September 22, 2026 23:56
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Time limit: 8 minutes. Complete the review and post all findings within that limit.

const root = configPreflight(command);
const cliPath = resolveProjectViteCli(root);
process.argv = [process.execPath, cliPath, command, ...rawArgs];
await import(/* @vite-ignore */ pathToFileURL(cliPath).href);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Load dotenv before every config dependency evaluates

Delegating here means the replacement dotenv bootstrap in index.ts cannot run until the config imports vinext. ESM evaluates earlier static dependencies first, so a config such as import "./env-reader.mjs"; import vinext from "vinext" now lets env-reader.mjs observe .env values as missing (and can fail before vinext is imported). The previous CLI called loadDotenv() before loading Vite or any config module, and the new test only covers a config that imports vinext first. Please restore pre-config dotenv loading for the parsed root/mode, or cover static config dependencies with an equivalent bootstrap.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: an ESM dependency of vite.config evaluates before the vinext plugin hook regardless of import order. Restoring wrapper-only pre-config dotenv would make vinext differ from direct vite, contrary to the required thin-proxy contract. The top adoption PR now explicitly documents the limitation and use of loadEnv in a config factory; I am leaving this thread unresolved as a deliberate compatibility decision for maintainer review.

@ask-bonk

ask-bonk Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

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.

1 participant