diff --git a/packages/create-vite/src/index.ts b/packages/create-vite/src/index.ts index dfc9473e23ff55..47d9dab68cf9ca 100755 --- a/packages/create-vite/src/index.ts +++ b/packages/create-vite/src/index.ts @@ -324,17 +324,27 @@ async function init() { if (customCommand) { const fullCustomCommand = customCommand - .replace(/^npm create/, `${pkgManager} create`) + .replace(/^npm create /, () => { + // `bun create` uses it's own set of templates, + // the closest alternative is using `bun x` directly on the package + if (pkgManager === 'bun') { + return 'bun x create-' + } + return `${pkgManager} create ` + }) // Only Yarn 1.x doesn't support `@version` in the `create` command .replace('@latest', () => (isYarn1 ? '' : '@latest')) .replace(/^npm exec/, () => { - // Prefer `pnpm dlx` or `yarn dlx` + // Prefer `pnpm dlx`, `yarn dlx`, or `bun x` if (pkgManager === 'pnpm') { return 'pnpm dlx' } if (pkgManager === 'yarn' && !isYarn1) { return 'yarn dlx' } + if (pkgManager === 'bun') { + return 'bun x' + } // Use `npm exec` in all other cases, // including Yarn 1.x and other custom npm clients. return 'npm exec'