Skip to content

svelte dependency bypasses entry points and optimizes any package with svelte as a dependency #1278

@gregroyal

Description

@gregroyal

Describe the bug

I noticed this because in my monorepo, i moved svelte from a devDependency to a dependency. This plugin caused my vite dev and vite build commands to drastically increase (30s to 7min). Its because for my entire monorepo, if a package has svelte a dependency, the plugin added it to optimize deps. Instead of just using my entry points to treeshake packages. I posted a ? in discord and got no response

this is the offending line
https://github.com/sveltejs/vite-plugin-svelte/blame/main/packages/vite-plugin-svelte/src/utils/options.js#L466

https://discord.com/channels/457912077277855764/1060332203571151019/threads/1461112660254003354
is this a bug? is there a right way to turn this off without just making svelte a devDep over a dep

Reproduction URL

NA

Reproduction

No response

Logs

System Info

System:
    OS: Linux 4.18 Red Hat Enterprise Linux 8.10 (Ootpa)
    CPU: (32) x64 Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz
    Memory: 27.97 GB / 61.63 GB
    Container: Yes
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 22.15.0
    npm: 11.6.2
    pnpm: 10.18.0
  Browsers:
    Chrome: 142.0.7444.162
    Firefox: 140.7.0esr
    Firefox Developer Edition: 140.7.0esr
  npmPackages:
    vite: ^7.3.1 => 7.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterbugSomething isn't workingtriageAwaiting triage by a project member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions