简体   繁体   中英

How to fix Cannot find module './aws-export' or its corresponding type declarations.ts (2307)

I am trying to integrate my project with aws (amazon web service ) After I initialize aws globally I decided to create a project call ELab by using the

following command

amplify init

and also using the following command to configure it

npm install aws-amplify @aws-amplify/ui-react 

then I add this to my App.tsx file

import Amplify from 'aws-amplify'
import config from './aws-exports' // error the /aws-exports.js was not generated
Amplify.configure(config)

After all those configuration aws fail to generate the aws-exports.js configuration file

is there any to resolve this issues thank you in advance

See this doc

https://docs.amplify.aws/start/getting-started/setup/q/integration/angular/#install-amplify-libraries

Strictly typing aws-exports If you have TypeScript strict mode on and see the error

Create a aws-exports.d.ts file on the same level as aws-exports with the following content:

declare const awsmobile: Record<string, any>
export default awsmobile;

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