I want to change root path of auto import

Now I'm using 'WebStorm 2018.2.5' on 'Windows 10'.

When I type 'regexList', then auto import working properly like below picture.

 

What I want is like to change root path like below.

I saw a post says change baseUrl of tsconfig.json, but when I change it errors showing like following picture.

How can I achieve my purpose?

0
6 comments

If you are using Typescript, you can try specifying path mappings in your tsconfig.json. Please see https://www.typescriptlang.org/docs/handbook/module-resolution.html, Path mapping

1
Avatar
Permanently deleted user

I already tried to change my tsconfig.json, but I could not find any solution.

This is my tsconfig.json.

Where do I fix?

0

looks OK at first sight. Can you share a sample project that shows up the issue? Did you try enabling TypeScript compiler service (as far as I can see from screenshot, reported error comes from WS own inspection, not from TS compiler)?

1
Avatar
Permanently deleted user

I already enabling typescript configs.

And also I upload my sample project on my bitbucket. Here's link.

https://bitbucket.org/akacanet87/tsconfigtest/src/master/ 

I comment as `TODO` in each file.

Thank you @ElenaPogorelova

0

You should have mentioned that you are working with Vue app... path mappings from tsconfig.json don't work in .vue imports (https://youtrack.jetbrains.com/issue/WEB-29799 is fixed in upcoming 2018.3)

2
Avatar
Permanently deleted user

Oh.. I'm sorry. It was my mistake.

But thank you anyway.

I really appreciate your comments!

1

Please sign in to leave a comment.