无法从node_modules typescript导入react-tap-event-plugin
发布时间:2020-12-15 16:17:55 所属栏目:百科 来源:网络整理
导读:我正在努力学习反应和打字稿.并希望在我的项目中包含 material-ui.从那里主页我被指示安装react-tap-event-plugin,我做了,并且“node_modules / react-tap-event-plugin”确实存在! 现在我应该这样做: import injectTapEventPlugin from 'react-tap-event-
我正在努力学习反应和打字稿.并希望在我的项目中包含
material-ui.从那里主页我被指示安装react-tap-event-plugin,我做了,并且“node_modules / react-tap-event-plugin”确实存在!
现在我应该这样做: import injectTapEventPlugin from 'react-tap-event-plugin'; injectTapEventPlugin(); 打字稿编译告诉我,它找不到模块. 我尝试了不同的变种(使用require,导入node_mdules / …),但没有任何效果. 如何正确设置? 这是我的package.json: { "private": true,"scripts": { "dev": "lite-server" },"dependencies": { "react": "^0.14.0","react-dom": "^0.14.0","fbjs": "^0.2.1","react-tap-event-plugin": "0.2.0","material-ui": "^0.14.0" } } 解决方法
您需要为react-tap-event-plugin安装
definition file (.d.ts).您可以通过执行以下操作来执行
typings:
>如果你没有安装打字,请安装npm install typings –global 另外,请务必在tsconfig.json中引用typings / index.d.ts. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |