Prevent WebStorm auto import from other Angular project in the same workspace

Viewed 77

I have angular repository with two projects: one is a library and second is an Angular application. I have used npm link to link library to my project. In package.json I have specified entry:

...
"my-lib": "~0.0.1"
...

I have also specified this PageQuery class in public-api.ts:

export * from './lib/table/models/paged-result';

When I want to use an exported element from the library in the app, WebStorm by default will do something like this:

import { PageQuery } from '../../../../../projects/my-lib/src/lib/page-query';

instead of this:

import { PageQuery } from 'my-lib';

Notice: Although it works when I type it as above manually, but I would like to inform WebStorm, that this should be the defeault import.

1 Answers

I think I found the answer myself. Looks like it didn't work in my previous version 2019.1. After upgrading to 2020.2 it gives the correct suggestion (the first one is the desired one): enter image description here

Related