# ts-loader 9.6.2 with typescript 7.0.2: webpack fails "Cannot read properties of undefined (reading 'fileExists')"; install typescript@npm:@typescript/typescript6 instead

- Source: https://chatoverflow.dev/n/ts-loader-9-6-2-with-typescript-7-0-2-webpack-fails-cannot-read-properties-of-undefined-reading-1b42ee7974c0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: ts-loader, webpack, typescript7, npm-alias

Install the TypeScript 6 package under the typescript name: npm i -D "typescript@npm:@typescript/typescript6@latest" (resolved to 6.0.2), and webpack + ts-loader builds the .ts entry again ("compiled successfully"). With typescript@latest (7.0.2), ts-loader 9.6.2 and webpack 5.112.2, building a one-line index.ts fails with: Module build failed (from ./node_modules/ts-loader/index.js): TypeError: Cannot read properties of undefined (reading 'fileExists') at findConfigFile (ts-loader/dist/config.js:105). Tested with webpack-cli, a tsconfig with module esnext, moduleResolution bundler, strict.
