From be9208f19b6e77e81b89a473a727cb7e88bdfecd Mon Sep 17 00:00:00 2001 From: Sheraff Date: Sat, 10 Oct 2026 20:28:04 +0200 Subject: [PATCH 1/2] Pass Start compat config to Vite without pnpm's `--` pnpm forwards a literal `--` to the script, so `pnpm run dev -- --config .tanstack/vite.config.mjs` ran `vite dev -- --config ...` and Vite ignored the config. Only npm needs the separator. Fixes #1353 Co-Authored-By: Claude Opus 5.5 --- src/utils/example-webcontainer-start.ts | 3 ++- tests/example-webcontainer-start.test.ts | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/utils/example-webcontainer-start.ts b/src/utils/example-webcontainer-start.ts index f2edf5987..3df1e50aa 100644 --- a/src/utils/example-webcontainer-start.ts +++ b/src/utils/example-webcontainer-start.ts @@ -129,7 +129,8 @@ export function getWebContainerStartCommand(runtime: ExampleRuntime) { } const args = [...runtime.start.args] - if (!args.includes('--')) args.push('--') + // pnpm forwards a literal `--` to the script, and Vite ignores everything after it. + if (runtime.start.command === 'npm' && !args.includes('--')) args.push('--') args.push('--config', tanStackStartViteConfigPath.slice(1)) return { command: runtime.start.command, args } diff --git a/tests/example-webcontainer-start.test.ts b/tests/example-webcontainer-start.test.ts index 0a683da7f..f53c0bf53 100644 --- a/tests/example-webcontainer-start.test.ts +++ b/tests/example-webcontainer-start.test.ts @@ -99,8 +99,18 @@ describe('TanStack Start WebContainer compatibility', () => { test('starts Vite with the hidden config only for the Start profile', () => { assert.deepEqual(getWebContainerStartCommand(startRuntime), { command: 'pnpm', - args: ['run', 'dev', '--', '--config', '.tanstack/vite.config.mjs'], + args: ['run', 'dev', '--config', '.tanstack/vite.config.mjs'], }) + assert.deepEqual( + getWebContainerStartCommand({ + ...startRuntime, + start: { command: 'npm', args: ['run', 'dev'] }, + }), + { + command: 'npm', + args: ['run', 'dev', '--', '--config', '.tanstack/vite.config.mjs'], + }, + ) assert.deepEqual( getWebContainerStartCommand({ From be86bf8b2bce4ae7cd8584b6cc650b59b4ad5ba5 Mon Sep 17 00:00:00 2001 From: Sheraff Date: Sat, 10 Oct 2026 20:55:29 +0200 Subject: [PATCH 2/2] Clarify why only npm gets the `--` separator Co-Authored-By: Claude Opus 5.5 --- src/utils/example-webcontainer-start.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/example-webcontainer-start.ts b/src/utils/example-webcontainer-start.ts index 3df1e50aa..efb705388 100644 --- a/src/utils/example-webcontainer-start.ts +++ b/src/utils/example-webcontainer-start.ts @@ -129,7 +129,7 @@ export function getWebContainerStartCommand(runtime: ExampleRuntime) { } const args = [...runtime.start.args] - // pnpm forwards a literal `--` to the script, and Vite ignores everything after it. + // npm needs `--` to forward args. pnpm would pass the `--` itself on to Vite, which ignores what follows. if (runtime.start.command === 'npm' && !args.includes('--')) args.push('--') args.push('--config', tanStackStartViteConfigPath.slice(1))