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

typescript gets included in node_modules

Open serg06 opened this issue 4 years ago • 7 comments

  • In yarn.lock, no package has typescript as a dependency
  • In package.json it's under devDependencies
  • In serverless.yml I have excludeDevDependencies: true

Yet for some reason when I run sls package, it's included under node_modules/typescript (and it's 60MB large!)

Tried with versions:

  • 1.1.9
  • 1.2.0
  • 2.0.0

serg06 avatar Sep 19 '21 22:09 serg06

@serg06 Are you stating that you have typescript listed in service devDependencies, yet it gets packaged for lambda (even though exclusion of dev dependencies is applied) ?

medikoo avatar Sep 20 '21 10:09 medikoo

@medikoo Yes exactly.

serg06 avatar Sep 24 '21 15:09 serg06

@serg06 will it happen also if you run sls package but with no plugins section in serverless.yml (I know it will create not working artifact, but I want to confirm whether any plugin influences that)

medikoo avatar Sep 24 '21 15:09 medikoo

@medikoo I can confirm that typescript is still included in the package, with excludeDevDependencies: true, using serverless ^3.15. No extra plugin.

tusbar avatar Apr 29 '22 13:04 tusbar

Is there any solution to this?

gualopezb avatar Aug 25 '22 16:08 gualopezb

IIRC I fixed it by adding this to serverless.yaml:

package:
  patterns:
    - '!node_modules/typescript/**'

Does that work? @gualopezb

serg06 avatar Aug 25 '22 17:08 serg06

Yes, it does the trick. I was just wondering if this is indeed an issue with the serverless-plugin-typescript module and, if so, is it going to be fixed in a future version?

gualopezb avatar Aug 30 '22 01:08 gualopezb