serverless / serverless-plugin-typescript

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

Error: [{"messageText":"Unknown compiler option 'incremental'.","category":1,"code":5023}] #236

Open jlarmstrongiv opened 3 years ago

jlarmstrongiv commented 3 years ago

Plugin throws an error if "incremental": true is in your tsconfig.json

This happens by default using Nest.js

Shiroh1ge commented 3 years ago

The error message is "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified. For now I set the option to false, but I fear the compilation may become slow over time.

GilSnappy commented 2 years ago

Is there a solution to this error message: Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified?

adamduren commented 2 years ago

@GilSnappy try adding to your tsconfig: "tsBuildInfoFile": ".tsbuildinfo", it worked for me

GilSnappy commented 2 years ago

It works, thanks! I hoped this would solve my slow compilation time, but it doesn't. Still over 10 seconds. tsconfig:

{
  "compilerOptions": {
    /* Language and Environment */
    "target": "ES2017",
    /* Modules */
    "module": "commonjs",
    "rootDir": ".",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    /* JavaScript Support */
    "allowJs": true,
    /* Emit */
    "declaration": true,
    "sourceMap": true,
    "outDir": "./dist",
    /* Interop Constraints */
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    /* Type Checking */
    "strict": true,
    "skipLibCheck": true,
    "tsBuildInfoFile": ".tsbuildinfo",
    "incremental": true
  },
  "include": ["functions", "utils"],
  "exclude": ["node_modules", "__tests__/**"]
}

typescript version 4.5.4 serverless-plugin-typescript version 1.1.7

Any ideas why this should be so slow?

adamduren commented 2 years ago

@GilSnappy after further testing I have determined it is not working as intended. In looking at how this plugin sets up the Typescript project it is recreated every time vs being re-used. I would guess this is introducing the increased overhead that we are seeing.

GilSnappy commented 2 years ago

I think that if I remove "tsBuildInfoFile": ".tsbuildinfo", "incremental": true it's the same time, or around that time. Too long :(