Skip to content

Respect kit.vite.esbuild config when building with Vercel adapter #1706

@mattjennings

Description

@mattjennings

Is your feature request related to a problem? Please describe.
I have a dependency that needs to be excluded from the bundle, so I mark it as external in svelte.config.js like so:

const config = {
  preprocess: preprocess(),

  kit: {
    adapter: vercel(),
    target: '#svelte',
    vite: {
      esbuild: {
        exclude: ['external-dependency']
      }
    }
  }
}

This correctly gets excluded in the .svelte-kit build, but it gets included in the adapter build's output.

Describe the solution you'd like
Use the kit.vite.esbuild settings from svelte.config.js in the adapter build

Describe alternatives you've considered
I noticed the node adapter excludes pkg.dependencies - maybe we just need to do the same for Vercel adapters? Is there a reason for doing that in one adapter and not another?

How important is this feature to you?
Important, I'm unable to deploy until I can exclude this dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions