Does Webstorm support typescript path alias?

I'm using Webstorm 3.0 EAP and I want to use typescript path alias feature after reading this introduction:


"baseUrl": "./",
"paths": {
"@baseImages/*": ["images/*"]

When I import the module like this in a tsx file:

import * as Images from "@baseImages"


Webstorm always says unable to `find the module @baseImages`. Does it support path alias?

1 comment
Comment actions Permalink

WebStorm 2018.3 definitely does support Typescript path mappings. But your mappings are wrong - you will see the same error when running tsc in terminal:

tsc -p .
app.ts:1:25 - error TS2307: Cannot find module '@baseImages'.

1 import * as Images from "@baseImages"

you just can't use barrel import from path that exactly matches the specified name prefix when using wildcards.. Adding one more path mapping seems to the the only way to go:

"baseUrl": "./",
"paths": {
"@baseImages/*": ["images/*"],
"@baseImages": ["images/"]



Please sign in to leave a comment.