Error TS6266: Build:Option 'listFilesOnly' can only be specified on command line

54 Views Asked by At

I encounter this error when building my React app using an Azure DevOps build pipeline. Any ideas on how to resolve it? I tried updating my tsconfig to include the "exclude": ["node_modules"] and "skipLibCheck": true properties, but still the error persists..

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
        "strict": false,
        "noImplicitAny": false,
        "strictPropertyInitialization": false,
        "esModuleInterop": true,
        "skipLibCheck": true
    },
    "include": ["src/*"],
    "exclude": ["node_modules"]
}
1

There are 1 best solutions below

0
greg On BEST ANSWER

I needed to update my .csproj to use ReactTsConfig instead of Content for any tsconfig.json files that were in nested folders:

<Content Include="tsconfig.json" />
<ReactTSConfig Include="path\to\folder\tsconfig.json" />