Search code examples
reactjstypescriptazure-devopstsconfigazureportal

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


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"]
}

Solution

  • 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" />