Skip to content

Offline is not using neither the provided esbuild config file nor ts-node as expected #1833

@Diboby

Description

@Diboby

Bug Report

Offline is not using neither the provided esbuild config file nor ts-node. The function works fine when deploying to aws with sls deploy or locally with sls dev. My project is based on NestJs, that means decorators et class metadata should be enabled in build configuration. When I run my code with ts-node, it works fine too. But the offline seems change the configuration and never add emission of metadata.

Sample Code

  • file: serverless.yml
service: my-service

plugins:
  - serverless-offline

build:
  esbuild:
    configFile: ./bundlers/esbuild/esbuild.config.mjs

provider:
  runtime: nodejs20.x
  stage: dev

functions:
  hello:
    events:
      - http:
          method: get
          path: hello
    handler: handler.hello

Note

  1. The esbuild configuration file extension is mjs
  2. serverless-offline is the only used plugin

Environment

  • serverless version: v4.4.7
  • serverless-offline version: v14.3.3
  • node.js version: v20
  • OS: macOS 15.0.1

Additional context/Screenshots

  1. The project is in typescript
  2. No file is output after the build using serverless-offline

Workaround

  • use sls dev instead of sls offline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions