serverless / serverless-plugin-typescript

Serverless plugin for zero-config Typescript support
MIT License
783 stars 223 forks source link

Compilation very slow #220

Open arzke opened 3 years ago

arzke commented 3 years ago

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?

vectorhacker commented 3 years ago

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

smcelhinney commented 3 years ago

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?

GilSnappy commented 2 years ago

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

jega-ms commented 2 years ago

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

RichardBradley commented 2 years ago

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

essaji commented 1 year ago

Its 2023 & this is still an issue

costa-collibra commented 9 months ago

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