"React refers to a UMD global, but the current file is a module" after upgrading to react 19 [duplicate]

22 hours ago 3
ARTICLE AD BOX

My issue here was TypeScript-related and similar, but not exactly the same, as those solutions already published herein.

What was wrong

I added nested directories with source code which were not included in my tsconfig.json.

The solution

Here's how I fixed it, simply adding additional .ts and .tsx paths to include, e.g.

// tsconfig.json { "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", "**/**/*.ts", "**/**/*.tsx" "<path-to-your-source>.ts", "<path-to-your-source>.tsx", ], }

My particular project is a Next.js project. Here's my full tsconfig.json:

{ "compilerOptions": { "sourceMap": true, "outDir": "dist", "strict": true, "lib": [ "esnext" ], "esModuleInterop": true, "target": "es5", "allowJs": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", "**/**/*.ts", "**/**/*.tsx" ], "exclude": [ "node_modules" ] }

The vast majority of the above tsconfig.json was generated via Next.js

Read Entire Article