Skip to content

Allow configuring "build.packages: external" on a per-function level #12960

@tkgregory

Description

@tkgregory

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Use case description

Project with 2 functions:

  1. Function already built externally (e.g. Nuxt uses Vite to produce code that's ready to go)
  2. Function to be built with esbuild

By default ESBuild bundles dependencies into a single file. Works great in most situations.

For functions that rely on pre-built code (e.g. Nuxt) the ESBuild processing results in failures like this:

✘ [ERROR] Could not resolve "tslib"

The only way I can get this to work is setting this global packages: external config:

build:
  esbuild:
    bundle: true
    packages: external

Applying this to all functions is undesirable, because dependencies will no longer be bundled.

I would like a way to control this setting on a per-function basis.

Proposed solution (optional)

This per-function configuration:

functions:
  nuxtSSREngine:
    build:
      esbuild:
        packages: external

Only enable if packages built indiidually:

package:
  individually: true

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions