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

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

Open jlarmstrongiv opened this issue 3 years ago • 6 comments

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

This happens by default using Nest.js

jlarmstrongiv avatar May 23 '21 09:05 jlarmstrongiv

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.

Shiroh1ge avatar Jun 22 '21 12:06 Shiroh1ge

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?

GilSnappy avatar Jan 06 '22 16:01 GilSnappy

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

adamduren avatar Jan 06 '22 16:01 adamduren

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?

GilSnappy avatar Jan 06 '22 17:01 GilSnappy

@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.

adamduren avatar Jan 06 '22 21:01 adamduren

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

GilSnappy avatar Jan 09 '22 08:01 GilSnappy