Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jsconfig path with WebStorm?

I am using WebStorm. On Ctrl + Click I am able to jump to file of definition:

import myClass from '../../../../core/myClass';

But if I am using a jsconfig.json file, it doesn't work.

/// jsonfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "Core/*": ["./app/bundles/core/*"],
    }
  },
  "exclude": [
    "node_modules"
  ]
}

and in my file I replace with :

import myClass from 'Core/myClass';

Bundling is working perfectly, but not jump to file with WebStorm.

Any idea what settings ?

like image 679
Stefdelec Avatar asked Feb 04 '19 14:02

Stefdelec


1 Answers

jsconfig.json is not currently supported by the IDE, please follow WEB-30581 and WEB-36390 for updates

You can try a workaround from https://youtrack.jetbrains.com/issue/WEB-22717#focus=streamItem-27-1558931-0-0: create a file config.js (you can use a different name) in your project root, define the path mappings there, like:


System.config({
    "paths": {
        "Core/*": "./app/bundles/core/*"
    }
});

Update: path aliases defined in jsconfig.json are supported since 2019.2; see WEB-36390

like image 158
lena Avatar answered Sep 23 '22 21:09

lena