Skip to content

Feature: Allow to configure plugins #206

@doktor500

Description

@doktor500

Hi,

I've managed to set up the serverless-esbuild plugin to use esbuild-plugin-tsc since I have code in my serverless functions that is using decorators.

My serverless.yml looks like this:

...
custom:
  esbuild:
    bundle: true
    minify: false
    plugins: esbuild-plugins.js

The esbuild-plugins.js file

const esbuildPluginTsc = {
  name: "esbuild-plugin-tsc",
  setup(build) {
    
  }
};

module.exports = [esbuildPluginTsc];

And for reference the tsconfig.json file

{
  "compilerOptions": {
    "baseUrl": ".",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "lib": ["es2018"],
    "moduleResolution": "node",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "rootDirs": ["fakes", "src", "scripts", "test"],
    "sourceMap": true,
    "strict": true,
    "target": "es2017",
    "types": ["jest", "node"],
    "skipLibCheck": true
  },
  "exclude": ["node_modules"]
}

The issue that I have is that I need to enable a flag on esbuild-plugin-tsc for it to work and I haven't found a way to do it.

What I would like to achieve is something similar to how plugins work on serverless-stack where instead of defining the name of the plugin, we can import it and configure it to set flags like "force: true".

Is this something that I can currently achieve? If not would it be possible to support this feature?

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