serverless-plugin-optimize icon indicating copy to clipboard operation
serverless-plugin-optimize copied to clipboard

Support for Typescript?

Open nabsofken opened this issue 4 years ago • 3 comments

I have a monorepo setup that uses typescript. How do I transpile the code using this plugin. For monorepos, the serverless-plugin-typescript plugin doesn't work for a monorepo setup. I am using the presets option provided but it doesn't seem to do anything. Any suggestions?

This is a snippet of my serverless.yml file

plugins:
  - serverless-plugin-optimize
  - serverless-offline
  - serverless-plugin-conditional-functions

custom:
  serverless-offline:
    noPrependStageInUrl: true
    useChildProcesses: true
    httpPort: 4004
  optimize:
    debug: true
    external: ['fastify']
    extensions: ['.ts', ".js"]
    presets: ['env', 'preset-typescript']

nabsofken avatar Nov 01 '20 15:11 nabsofken

@nabsofken I haven't tried it but according to https://insify.medium.com/serverless-with-typescript-in-a-monorepo-4-ways-to-make-it-work-4ea0b8f43608 it would work in conjunction with serverless-plugin-typescript (see "Attempt 4")

nilsm avatar Nov 22 '20 21:11 nilsm

@nilsm the serverless-plugin-typescript plugin doesn't work well when you have external dependencies i.e. A shared folder. The files or node modules from the shared folder do not get packaged within the services through this plugin. I am using the serverless webpack plugin with ts-loader and that seems to work, however, the package size is larger. Not sure if this plugin can support ta-loader

nabsofken avatar Nov 23 '20 02:11 nabsofken

Me too. The same blog brought me here, but i cannot find a way to make it work with typescript + yarn worksapce.

softmarshmallow avatar Dec 10 '20 04:12 softmarshmallow