navigation to absolute file path

hello i am using es6 imports and i have a problem with navigation

if i am importing to relative path '../something' i can press CTRL and click on 'something' and this file will be opened,

but if i have absolute path 'components/something' it shows me 'module is not installed'

Anyone know how to fix this?

4 comments

Where do these absolute paths come from? you must be using some tool that resolves paths in a special way, it won't work otherwise. So, what plugins/tools do you use? Webpack, Babel, etc.? How are aliases mapped to folders?

0

I think i solved this problem by adding path to webpack config in webstorm

 

1

@4knort can you share an example of what your webpack config looks like now?

0

It can be a dummy config like this:

module.exports = {
entry: {
app: ['./app.js']
},
resolve: {

alias: {
'myAlias': path.resolve('./my/path'),
}

}
};

 

you need to choose this config as webpack configuration file in Settings | Languages & Frameworks | JavaScript | Webpack

or, 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": {
        "myAlias/*": "./my/path*"
    }
});
0

Please sign in to leave a comment.