{"record":{"id":"ff540903d233e0af","repo":"react/create-react-app","slug":"you-have-both-a-tsconfig-json-and-a-jsconfig-json","errorCode":null,"errorMessage":"You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.","messagePattern":"You have both a tsconfig\\.json and a jsconfig\\.json\\. If you are using TypeScript please remove your jsconfig\\.json file\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-scripts/config/modules.js","lineNumber":108,"sourceCode":"    return {};\n  }\n\n  const baseUrlResolved = path.resolve(paths.appPath, baseUrl);\n\n  if (path.relative(paths.appPath, baseUrlResolved) === '') {\n    return {\n      '^src/(.*)$': '<rootDir>/src/$1',\n    };\n  }\n}\n\nfunction getModules() {\n  // Check if TypeScript is setup\n  const hasTsConfig = fs.existsSync(paths.appTsConfig);\n  const hasJsConfig = fs.existsSync(paths.appJsConfig);\n\n  if (hasTsConfig && hasJsConfig) {\n    throw new Error(\n      'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'\n    );\n  }\n\n  let config;\n\n  // If there's a tsconfig.json we assume it's a\n  // TypeScript project and set up the config\n  // based on tsconfig.json\n  if (hasTsConfig) {\n    const ts = require(resolve.sync('typescript', {\n      basedir: paths.appNodeModules,\n    }));\n    config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;\n    // Otherwise we'll check if there is jsconfig.json\n    // for non TS projects.\n  } else if (hasJsConfig) {\n    config = require(paths.appJsConfig);","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/react/create-react-app/blob/6254386531d263688ccfa542d0e628fbc0de0b28/packages/react-scripts/config/modules.js#L90-L126","documentation":"modules.getModules detects TypeScript setup by checking for tsconfig.json and jsconfig.json existence. Both files configuring module resolution at once is ambiguous and TypeScript-dominant, so CRA refuses to continue and asks the user to remove jsconfig.json. The check is two fs.existsSync calls combined with &&.","triggerScenarios":"Both paths.appTsConfig (tsconfig.json) and paths.appJsConfig (jsconfig.json) exist on disk. The `hasTsConfig && hasJsConfig` branch throws before either is parsed.","commonSituations":"Starting a project as JavaScript (jsconfig.json auto-created by editors), then adding TypeScript (tsconfig.json) without deleting jsconfig.json. Editor extensions re-creating jsconfig.json after a TS migration. Copying a project template that includes both.","solutions":["If you are using TypeScript, delete jsconfig.json from the project root.","If you are using plain JavaScript, delete tsconfig.json.","After deleting, restart your editor/IDE to clear cached config.","Add jsconfig.json to .gitignore only if intentionally JS-only, to prevent accidental re-creation alongside a TS setup."],"exampleFix":"# before\nls\n# jsconfig.json  package.json  tsconfig.json\n# after\nrm jsconfig.json\nls\n# package.json  tsconfig.json","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction assertSingleConfig(root = process.cwd()) {\n  const hasTs = fs.existsSync(path.join(root, 'tsconfig.json'));\n  const hasJs = fs.existsSync(path.join(root, 'jsconfig.json'));\n  if (hasTs && hasJs) {\n    throw new Error('Both tsconfig.json and jsconfig.json present. Remove one.');\n  }\n}\nassertSingleConfig();","typeGuard":"const hasSingleConfig = (root) =>\n  !(fs.existsSync(path.join(root, 'tsconfig.json')) &&\n    fs.existsSync(path.join(root, 'jsconfig.json')));","tryCatchPattern":"try {\n  require('react-scripts/config/modules').getModules();\n} catch (e) {\n  if (/tsconfig.json and a jsconfig.json/.test(e.message)) {\n    console.error('Delete jsconfig.json if using TypeScript.');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["After migrating to TypeScript, delete jsconfig.json.","Tell your team/editor not to recreate jsconfig.json in TS projects.","Add a repo check (CI) that fails when both files exist.","Pick one config convention and document it in the README."],"tags":["typescript","config","jsconfig","conflict"],"backgroundTag":null,"analyzedSha":"6254386531d263688ccfa542d0e628fbc0de0b28","analyzedAt":"2026-08-12T22:55:01.751Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}