ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: Electron vite init

Open mrafieefard opened this issue 1 year ago • 1 comments

Describe the bug

I'm trying to install shadcn on electron vite but when I use bunx --bun shadcn@latest init I get Verifying framework error

✔ Preflight checks.
✖ Verifying framework.

We could not detect a supported framework at I:\Nodejs\test-app2.
Visit https://ui.shadcn.com/docs/installation/manual to manually configure your project.
Once configured, you can use the cli to add components.

I know there are other module for electron, vite and shadcn but I want to use officials

When I use shadcn cli 0.8.0 I can install successful but not for latest version

Affected component/components

None

How to reproduce

  1. init electron vite project
  2. install tailwind
  3. try to init shadcn using bunx

Codesandbox/StackBlitz link

No response

Logs

✔ Preflight checks.
✖ Verifying framework.

We could not detect a supported framework at I:\Nodejs\test-app2.
Visit https://ui.shadcn.com/docs/installation/manual to manually configure your project.
Once configured, you can use the cli to add components.

System Info

Windows 10

Before submitting

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

mrafieefard avatar Sep 29 '24 17:09 mrafieefard

electron.vite.config.ts is part of electron vite package

mrafieefard avatar Oct 02 '24 16:10 mrafieefard

@mrafieefard Duplicate your electron.vite.config.ts to vite.config.ts, shadcn needs the vite.config.ts to exist (for its preflight checks), but electron-vite requires electron.vite.config.ts to exist (no idea why, but it cant be named vite.config.ts). To prevent duplicating files you can import one into the other so you only have to write the config once.

rafeautie avatar Oct 26 '24 04:10 rafeautie

@rafeautie can you please share your electron-vite-shadcn project structure?

ilomon10 avatar Nov 12 '24 01:11 ilomon10

@rafeautie can you please share your electron-vite-shadcn project structure?

Sure image

@mrafieefard Duplicate your electron.vite.config.ts to vite.config.ts, shadcn needs the vite.config.ts to exist (for its preflight checks), but electron-vite requires electron.vite.config.ts to exist (no idea why, but it cant be named vite.config.ts). To prevent duplicating files you can import one into the other so you only have to write the config once.

I will check it but I think this idea works

mrafieefard avatar Nov 12 '24 12:11 mrafieefard

I can confirm making a copy of your electron.vite.config.ts and calling it vite.config.ts works. Depending on your configuration you do not even need to import the vite.config.ts. Just having it in the root directory was enough to get Shadcn to install using the vite framework guide and npx init. Just make sure to copy the contents of your electron.vite.config.ts, do not just the create a file named vite.config.ts.

CrypticVillain avatar Feb 22 '25 01:02 CrypticVillain

Hi. We're closing some old issues as outdated. If this is still relevant (and not fixed in main), leave a message, we'll reopen it. Thank you. Appreciate your contribution to the project - shadcn

shadcn avatar Oct 16 '25 10:10 shadcn