EN · DE · RU · FR · ES

#2764: tsconfig.json

projectforge-webapp/tsconfig.json TypeScript Compiler Configuration · projectforge-webapp/tsconfig.json 35 lines · 35 code · 0 comments · 0 blank
The TypeScript compiler configuration for the ProjectForge React webapp. Controls all aspects of type-checking, module resolution, JSX transpilation, and file inclusion for the frontend codebase. Originally targeting ES5 with classic React JSX and CRA-compatible module resolution (node), it has evolved across four significant iterations to support modern ESNext output, the new JSX transform (react-jsx), bundler-based module resolution, and Vite compatibility.

Architecture

Key Settings and Their Evolution

Target: Started at es5 (the CRA default for maximum browser compatibility), upgraded to esnext during the Vite migration. Vite handles transpilation to specific browser targets separately, so the TypeScript layer can target the latest JS features.

Module Resolution: Changed from node (CRA default, resolves modules using Node.js resolution algorithm) to bundler (Vite-compatible, understands exports field in package.json and conditional exports). This was the most impactful migration change — node resolution would fail to resolve some packages in Vite's ESM-first context.

JSX: Initially used both "jsx": "react" and "jsx": "react-jsx" (duplicate entries — a CRA artifact), cleaned up to just "react-jsx". This enables the new JSX transform (React 17+) where import React from 'react' is no longer required in every JSX file.

Include Patterns: Evolved from a catch-all "src" to explicit glob patterns (src/**/*.tsx, src/**/*.ts, src/**/*.js, etc.), then expanded to include .d.ts files and react-app-env.d.ts, and finally vite-env.d.ts replacing the CRA declaration.

Strict Mode: Enabled from the start ("strict": true), providing null checks, strict function types, and strict property initialization across the frontend codebase.

Git History

CommitWhat changed
bf988bc6dThree changes for the Vite migration: (1) target upgraded from es5 to esnext — Vite handles browser compatibility, not TypeScript; (2) moduleResolution changed from node to bundler — required for Vite's ESM-first module handling; (3) include list entry changed from src/react-app-env.d.ts to src/vite-env.d.ts — aligning with the new build tool.
f867698d3Expanded the include patterns to cover src/**/*.ts, src/**/*.d.ts, and added src/react-app-env.d.ts explicitly. This was needed as the codebase started adopting TypeScript alongside existing JavaScript files, requiring the compiler to pick up new .ts and declaration files.
87c1212c2Removed the duplicate "jsx": "react" entry (leaving only "jsx": "react-jsx" at the bottom). Changed include from the catch-all "src" to specific glob patterns (src/**/*.tsx, src/**/*.js, src/**/*.jsx, src/**/*.scss) and added an exclude for node_modules. This was part of the multi-upload feature work, tightening the build configuration.
377b3e3acCreated the initial tsconfig.json for the webapp. Established the baseline configuration with es5 target, CRA-compatible settings, the duplicate jsx entries, and the simple "include": ["src"] pattern. This was the starting point when the React frontend was first introduced into the ProjectForge monorepo.