[英]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. 我有一个使用
Create React App
,到目前为止运行良好。 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. 无论如何,因此每当我尝试启动该应用程序时,它都会抱怨存在
.ts
文件(位于node_modules
文件夹中),并迫使我安装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.
因为当前,安装TypeScript只会打开一瓶蠕虫,我需要在其中解决出现的TypeScript错误。
Also, as the screenshot suggests, removing the tsconfig.json file doesn't resolve the issue, it gets automatically created on every run.. 另外,如屏幕截图所示,删除tsconfig.json文件不能解决问题,它会在每次运行时自动创建。
Currently because it's preventing me to work, I've done the following modification until they fix it on the Create React App: 目前,由于它妨碍了我的工作,我做了以下修改,直到他们在Create React App上修复它为止:
Current solution until they fix the create react app 当前解决方案,直到他们修复了create react应用
On the file node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
, find the definition of verifyNoTypeScript()
(line 24). 在文件
node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
,找到verifyNoTypeScript()
的定义(第24行)。 Replace the function to the following: 将函数替换为以下内容:
function verifyNoTypeScript() { return true; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.