Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/utils/example-webcontainer-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export function getWebContainerStartCommand(runtime: ExampleRuntime) {
}

const args = [...runtime.start.args]
if (!args.includes('--')) args.push('--')
// 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))

return { command: runtime.start.command, args }
Expand Down
12 changes: 11 additions & 1 deletion tests/example-webcontainer-start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading