Module problems with Webstorm Project


I have an issue with a new ionic mobile project which contains a structure like this:
-project root
    - mobile

        - app1

        - app2

        - shared

    - web

        - web1

app1 and app2 use files from shared.

The thing is, app1 and app2 contain their own package.json, tsconfig files. Whenever I want to import to app1 from shared in this way:

import { function1 } from '~/shared/function1;

It says 'TS2307: Cannot find Module'

I can just fix it by changing the import to "../../../../shared/function1" but this is not acceptable since I'd have to refractor the entire project.

Is there a solution to this? Why does the '~' not work?


1 comment

Hi! Could you please provide your tsconfig files or, if possible, a sample project?


Please sign in to leave a comment.