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

Compilation very slow

Open arzke opened this issue 4 years ago • 7 comments

Hello,

every time I change one of the typescript files, it takes about 20 seconds to compile. I am currently using the following tsconfig.json configuration:

{
  "compilerOptions": {
    "target": "es2019",
    "outDir": ".build",
    "moduleResolution": "node",
    "lib": ["es2019"],
    "rootDir": "./",
    "baseUrl": "./src",
  },
  "include": ["src/**/*.ts"],
  "exclude": ["src/**/*.test.ts"]
}

Any reason why the compilation times are so slow?

arzke avatar Nov 19 '20 00:11 arzke

This seems to be an issue with the latest version of the plugin. I downgraded to 1.1.7 and it went faster.

vectorhacker avatar Jan 14 '21 07:01 vectorhacker

The downgrade didn't resolve the issue for me, still very slow. I have also noticed that if I edit more than 1 .ts file and Save All in VSCode, it will attempt to compile them all serially (as in, one after the other). Is this expected behaviour?

smcelhinney avatar May 26 '21 08:05 smcelhinney

Can confirm that this is still the case now (using serverless-plugin-typescript: 1.1.7, 1.2.0 and 2.1.0). Any solution?

Using skipLibCheck makes the compilation a bit faster, about 10 seconds

GilSnappy avatar Jan 06 '22 16:01 GilSnappy

i'm facing the same issue with latest release "2.1.1" any updates/workaround ?

jega-ms avatar Feb 16 '22 08:02 jega-ms

I have the same problem. I have about 800 source files in my project and it takes about 30 sec to recompile when I change a single file.

I have verified that typescript is running in "watch" mode inside serverless-plugin-typescript, so I think this is probably a limitation of typescript itself rather than something that serverless-plugin-typescript is doing wrong.

If anyone has any tips to improve compile time they would be gratefully received.

Some discussion on this here: https://github.com/microsoft/TypeScript/issues/46420

RichardBradley avatar Aug 26 '22 11:08 RichardBradley

Its 2023 & this is still an issue

essaji avatar Jun 13 '23 07:06 essaji

Can confirm that this is still the case now (using serverless-plugin-typescript: 1.1.7, 1.2.0 and 2.1.0). Any solution?

Using skipLibCheck makes the compilation a bit faster, about 10 seconds

This flag worked wonders for me it’s now under a second thanks for this tip. Was around 20 seconds before

costa-collibra avatar Dec 12 '23 22:12 costa-collibra