Current behavior
Running Cypress 15.14.1 e2e tests with TypeScript 6 produces:
Error: Webpack Compilation Error
[tsl] ERROR
TS5011: The common source directory of 'tsconfig.json' is './e2e'. The 'rootDir' setting must be explicitly set to handle the input files.
This occurs despite tsconfig.json having "rootDir": ".." explicitly set. TypeScript 6 strict rootDir enforcement is triggered because the bundled ts-loader@9.5.2 calls transpileModule with rootDir: undefined, overriding the tsconfig. See: TypeStrong/ts-loader#1678. Fixed in ts-loader 9.5.7. The pin lives in npm/webpack-batteries-included-preprocessor/package.json → "ts-loader": "9.5.2".
Note: This is distinct from #33385 (TS5101/TS5107 deprecated options). Component tests are unaffected; only the e2e webpack preprocessor is impacted.
Desired behavior
e2e specs compile without error when using TypeScript 6.
Test code to reproduce
- Create a project with Cypress 15.14.1 and TypeScript 6
- Add any e2e spec in e2e
- Set
"typescript": "^6.0.0" in package.json
- Run
npx cypress run --e2e
Minimal reproduction: add "rootDir": ".." to tsconfig.json — the error persists because ts-loader ignores it.
Cypress Version
15.14.1
Debug Logs
cypress:webpack-batteries-included-preprocessor found user tsconfig.json at <project>/cypress/tsconfig.json with compilerOptions: {"rootDir":"..","skipLibCheck":true,...}
cypress:webpack ts-loader detected: overriding tsconfig to use sourceMap:true, inlineSourceMap:false, inlineSources:false (TypeScript 6.0.3)
cypress:webpack typescript version 6.0.3 is not supported for monkey-patching
cypress:webpack stats had error(s) [{
moduleIdentifier: '.../ts-loader/index.js??ruleSet[1].rules[3].use[0]!/path/to/cypress/e2e/mytest.cy.ts',
message: '[tsl] ERROR\n TS5011: The common source directory of \'tsconfig.json\' is \'./e2e\'. The \'rootDir\' setting must be explicitly set to this or another path to adjust your output\'s file layout.\n Visit https://aka.ms/ts6 for migration information.',
stack: 'Error: [tsl] ERROR\n TS5011: ...\n at getTranspilationEmit (.../ts-loader/dist/index.js:428:49)\n at successLoader (.../ts-loader/dist/index.js:38:11)\n at Object.loader (.../ts-loader/dist/index.js:23:5)'
}]
Other
Expected fix: bump ts-loader from 9.5.2 → >=9.5.7 in npm/webpack-batteries-included-preprocessor/package.json.
see: https://github.com/TypeStrong/ts-loader/releases/tag/v9.5.7
Current behavior
Running Cypress 15.14.1 e2e tests with TypeScript 6 produces:
This occurs despite tsconfig.json having
"rootDir": ".."explicitly set. TypeScript 6 strictrootDirenforcement is triggered because the bundledts-loader@9.5.2callstranspileModulewithrootDir: undefined, overriding the tsconfig. See: TypeStrong/ts-loader#1678. Fixed in ts-loader 9.5.7. The pin lives innpm/webpack-batteries-included-preprocessor/package.json→"ts-loader": "9.5.2".Note: This is distinct from #33385 (TS5101/TS5107 deprecated options). Component tests are unaffected; only the e2e webpack preprocessor is impacted.
Desired behavior
e2e specs compile without error when using TypeScript 6.
Test code to reproduce
"typescript": "^6.0.0"in package.jsonnpx cypress run --e2eMinimal reproduction: add
"rootDir": ".."to tsconfig.json — the error persists because ts-loader ignores it.Cypress Version
15.14.1
Debug Logs
Other
Expected fix: bump
ts-loaderfrom9.5.2→>=9.5.7innpm/webpack-batteries-included-preprocessor/package.json.