Reactjs &引用;找不到声明文件";Heroku上的react脚本ts应用程序
我有一个Heroku应用程序的React with Typescript前端,客户端存储在Reactjs &引用;找不到声明文件";Heroku上的react脚本ts应用程序,reactjs,typescript,heroku,Reactjs,Typescript,Heroku,我有一个Heroku应用程序的React with Typescript前端,客户端存储在client/下,在我的顶级package.json中,我有以下内容: ... "heroku-prebuild": "cd client && yarn && yarn run build", ... 在客户机文件夹中,我在devDependencies下有Typescript和相关依赖项,并且客户机构建(react scripts ts build)在本地运行良好。但是
client/
下,在我的顶级package.json中,我有以下内容:
...
"heroku-prebuild": "cd client && yarn && yarn run build",
...
在客户机文件夹中,我在devDependencies
下有Typescript和相关依赖项,并且客户机构建(react scripts ts build
)在本地运行良好。但是,在Heroku上,我在生成输出中得到以下错误:
/tmp/build_c4236577d559126ce645e4d8e04323f1/client/src/App.tsx
(3,37): Could not find a declaration file for module 'react-router-dom'. '/tmp/build_c4236577d559126ce645e4d8e04323f1/client/node_modules/react-router-dom/index.js' implicitly has an 'any' type.
Try `npm install @types/react-router-dom` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-router-dom';`
然而,在我的客户的package.json中显然有@types/react router dom
:
"devDependencies": {
"@types/jest": "^23.3.10",
"@types/node": "^10.12.12",
"@types/react": "^16.7.13",
"@types/react-dom": "^16.0.11",
"@types/react-router-dom": "^4.3.1",
"typescript": "^3.2.2",
"tslint": "^5.11.0"
}
问题只出现在Heroku身上。我怎样才能解决这个问题