diff --git a/internal/functions/deploy/bundle.go b/internal/functions/deploy/bundle.go index 974838374e..1bdc23fb97 100644 --- a/internal/functions/deploy/bundle.go +++ b/internal/functions/deploy/bundle.go @@ -50,7 +50,7 @@ func (b *dockerBundler) Bundle(ctx context.Context, slug, entrypoint, importMap } hostOutputPath := filepath.Join(hostOutputDir, "output.eszip") // Create exec command - cmd := []string{"bundle", "--entrypoint", utils.ToDockerPath(entrypoint), "--output", utils.ToDockerPath(hostOutputPath), "--decorator", "tc39"} + cmd := []string{"bundle", "--entrypoint", utils.ToDockerPath(entrypoint), "--output", utils.ToDockerPath(hostOutputPath)} if len(importMap) > 0 { cmd = append(cmd, "--import-map", utils.ToDockerPath(importMap)) } @@ -60,6 +60,7 @@ func (b *dockerBundler) Bundle(ctx context.Context, slug, entrypoint, importMap if viper.GetBool("DEBUG") { cmd = append(cmd, "--verbose") } + cmd = append(cmd, function.BundleFlags...) env := []string{} if custom_registry := os.Getenv("NPM_CONFIG_REGISTRY"); custom_registry != "" { diff --git a/pkg/function/bundle.go b/pkg/function/bundle.go index 486bd4be66..27e4d7660e 100644 --- a/pkg/function/bundle.go +++ b/pkg/function/bundle.go @@ -29,8 +29,13 @@ func NewNativeBundler(tempDir string, fsys fs.FS) EszipBundler { } } -// Use a package private variable to allow testing without gosec complaining about G204 -var edgeRuntimeBin = "edge-runtime" +var ( + // Use a package private variable to allow testing without gosec complaining about G204 + edgeRuntimeBin = "edge-runtime" + BundleFlags = []string{ + "--decorator", "tc39", + } +) func (b *nativeBundler) Bundle(ctx context.Context, slug, entrypoint, importMap string, staticFiles []string, output io.Writer) (api.FunctionDeployMetadata, error) { meta := NewMetadata(slug, entrypoint, importMap, staticFiles) @@ -43,6 +48,7 @@ func (b *nativeBundler) Bundle(ctx context.Context, slug, entrypoint, importMap for _, staticFile := range staticFiles { args = append(args, "--static", staticFile) } + args = append(args, BundleFlags...) cmd := exec.CommandContext(ctx, edgeRuntimeBin, args...) cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout