简体   繁体   中英

How to prevent Create React App from forcing me to install TypeScript because a dependency has a ts file in it

I have a React app created using Create React App that was running fine until today. Something must have updated the last time I installed a new package. Anyhow, so whenever I try to start the app, it complains that there are .ts files (within node_modules folder) and forces me to install TypeScript.

Is there any way to stop this behaviour? Because currently, installing TypeScript just opens a bottle of worms, where I need to resolve the TypeScript errors that arises.

Also, as the screenshot suggests, removing the tsconfig.json file doesn't resolve the issue, it gets automatically created on every run.. 错误的屏幕截图

Currently because it's preventing me to work, I've done the following modification until they fix it on the Create React App:

Current solution until they fix the create react app

On the file node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js , find the definition of verifyNoTypeScript() (line 24). Replace the function to the following:

function verifyNoTypeScript() { return true; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM