AWS Amplify deploy Angular 9. Cannot find module

Viewed 745

I am trying to set up deployment for my angular 9 project using AWS Amplify. This is my .YML file

version: 0.1
frontend:
  phases:
    preBuild:
      commands:
        - nvm use $VERSION_NODE_12
        - npm install
        - npm install -g @angular/cli
    build:
      commands:
        - nvm use $VERSION_NODE_12
        - ng build app-call --prod
  artifacts:
    baseDirectory: dist/apps/app-call
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

But I am getting a build error:

2020-04-08T13:57:57.706Z [WARNING]: ERROR in libs/call/src/classes/index.ts:1:18 - error TS2307: Cannot find module './Util'.
                                    1 import Util from './Util';

Locally the solution builds fine. Looks like I am missing something. Any idea what?

1 Answers

I had this problem where the project runs locally but not when published to amplify, it turned out that files need to be named like this name.domain.ts.

so yours will be util.model.ts or util.service.ts and like so.

There should be a config somewhere in tsconfig to allow naming style you are using but I think it is a good practice to follow the standards.

Related