Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies like bits-ui should be installed as devDependencies and not dependencies #1304

Closed
khromov opened this issue Oct 6, 2024 · 6 comments · Fixed by #1315
Closed
Labels
status: help wanted This issue is tentatively accepted pending a volunteer committed to its implementation type: CLI

Comments

@khromov
Copy link

khromov commented Oct 6, 2024

Describe the bug

When deploying SvelteKit sites using adapter-node, whether you use dependencies or devDependencies matter. devDependencies get bundled by Rollup, while normal dependencies are left in node_modules and externalized. By default, when adding components with npx shadcn-svelte@latest add dependencies like bits-ui are added to dependencies when it's preferential that they be in devDependencies.

Development dependencies will be bundled into your app using Rollup. To control whether a given package is bundled or externalised, place it in devDependencies or dependencies respectively in your package.json.

https://kit.svelte.dev/docs/adapter-node#deploying

This is a follow-up on #580 which was closed because I think it was not correctly interpreted.

Reproduction

Logs

No response

System Info

System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M2
    Memory: 79.09 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.nvm/versions/node/v22.9.0/bin/node
    npm: 10.8.3 - ~/.nvm/versions/node/v22.9.0/bin/npm
  Browsers:
    Chrome: 129.0.6668.90
    Safari: 18.0.1
    Safari Technology Preview: 18.0
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.6.2 
    bits-ui: ^0.21.16 => 0.21.16 
    lucide-svelte: ^0.447.0 => 0.447.0 
    svelte: ^4.2.7 => 4.2.19

Severity

annoyance

@huntabyte
Copy link
Owner

Bits UI is a production dependency, which is why it is in dependencies and not devDependencies 😃

@huntabyte
Copy link
Owner

If a component library isn't a production dependency/non-dev dependency then I'm not sure what would go into dependencies

@huntabyte
Copy link
Owner

Alright after some discussion with others you are correct. I didn't consider the fact of running npm i --production and having bits-ui, etc. be included in the node_modules that gets shipped into a container.

We'll update this once we get a chance unless someone wants to make a PR!

@huntabyte huntabyte added status: help wanted This issue is tentatively accepted pending a volunteer committed to its implementation type: CLI labels Oct 7, 2024
@khromov
Copy link
Author

khromov commented Oct 9, 2024

🙇 Thanks Hunter, really appreciate it!

@ieedan
Copy link
Contributor

ieedan commented Oct 10, 2024

Alright after some discussion with others you are correct. I didn't consider the fact of running npm i --production and having bits-ui, etc. be included in the node_modules that gets shipped into a container.

We'll update this once we get a chance unless someone wants to make a PR!

It looks like to make this happen we would need to update the registrySchema to include a devDependencies section. Unless I am missing something?

Or can we safely say everything is a dev dependency?

I do have everything in my projects installed as a dev dependency with no issues using almost all of the components.

@huntabyte
Copy link
Owner

huntabyte commented Oct 11, 2024

Everything we install should be a dev dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted This issue is tentatively accepted pending a volunteer committed to its implementation type: CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants