![](/img/trans.png)
[英]AWS CDK Code Pipeline Development - Typescript Error TS2307
[英]How to fix Cannot find module './aws-export' or its corresponding type declarations.ts (2307)
我正在嘗試將我的項目與 aws(亞馬遜 web 服務)集成 在我全局初始化 aws 之后,我決定使用
以下命令
amplify init
並使用以下命令對其進行配置
npm install aws-amplify @aws-amplify/ui-react
然后我將其添加到我的 App.tsx 文件中
import Amplify from 'aws-amplify'
import config from './aws-exports' // error the /aws-exports.js was not generated
Amplify.configure(config)
在所有這些配置 aws 無法生成 aws-exports.js 配置文件之后
有沒有解決這個問題的辦法 提前謝謝
看這個文檔
嚴格輸入 aws-exports 如果您開啟了 TypeScript 嚴格模式並看到錯誤
使用以下內容在與 aws-exports 相同級別上創建一個 aws-exports.d.ts 文件:
declare const awsmobile: Record<string, any>
export default awsmobile;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.