AWS Amplify Angular JS sample code not working on local machine

0

Steps given to get started with Angular.js to run in local is failing with compilation error.

import { Customer } from './models'; Above line is throwing an error: "Cannot find module './models' or its corresponding type declarations"

AWS
질문됨 2년 전1586회 조회
2개 답변
0

From the note I understand you want to import { Customer } from './models'; from Angular JS and is throwing an error: "Cannot find module”.

Please note the "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project. To solve the error, make sure to install the module and try setting moduleResolution to node in your tsconfig. json file.

If the module is a third-party module, make sure you have it installed.

shell npm install module-name npm install --save-dev @types/module-name

Make sure to replace module-name with the name of the module in your error message.

I hope this helps.

References:

https://bobbyhadz.com/blog/typescript-cannot-find-module

답변함 2년 전
0

Check TypeScript Configuration: Could you verify that the TypeScript configuration in your AngularJS project is correctly set up?

In your tsconfig.json file, you might have something like:

"baseUrl": "./src",
"paths": {
  "@app/*": ["app/*"]
}

Then, you can import your models using the configured path:

import { Customer } from '@app/models';
AWS
답변함 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠