Skip to content

Commit ced56f8

Browse files
fix(vite): bundle cli for npx runtime
Changed the build to target Node SSR instead of Vite’s default client/lib pipeline, and stopped externalizing the TUI stack. The relevant change is in `vite.config.mts:6: build.ssr = 'src/cli.ts'`, a fixed `cli.js` entry name, and removal of `react`/`ink`/`@inkjs/ui` from external. That removes the emitted Rolldown fallback that was throwing `Calling require for "react"` when the binary was launched via `npx`. The new build no longer contains that runtime stub, and `node dist/cli.js --help` now runs successfully.
1 parent 5eaad8f commit ced56f8

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

vite.config.mts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@ import { defineConfig } from 'vitest/config';
55
export default defineConfig({
66
build: {
77
target: 'node24',
8-
lib: {
9-
entry: 'src/cli.ts',
10-
formats: ['es'],
11-
fileName: 'cli',
12-
},
8+
ssr: 'src/cli.ts',
139
rolldownOptions: {
10+
output: {
11+
entryFileNames: 'cli.js',
12+
},
1413
external: [
15-
'@inkjs/ui',
1614
'cac',
17-
'ink',
1815
'node:child_process',
1916
'node:fs',
2017
'node:os',
2118
'node:path',
2219
'node:util',
2320
'ollama',
24-
'react',
2521
],
2622
},
2723
},

0 commit comments

Comments
 (0)