RubyMine does not recognize Javascript import when absolute path is used

When importing a module using either a named import or a namespace with a relative path RubyMine reports the imported component as unused.

When using a absolute path the imported component reports correctly as used.

example:

exporting_module.js in rootDir/dirA/dirB/dirC

// this reports as unused
export const exportingFunction: function () {
// code here
}

importing module in rootDir/dirD/dirE/dirF

import { exportingFunction } from "~/dirA/dirB/dirC/exportingModule"
...
exportingFunction(); // used here

When done with absolute path export (in exporting_module.js) reports as used

import { exportingFunction } from "../../../dirA/dirB/dirC/exportingModule"
...
exportingFunction(); // used here

webpack_config.js

...
const
ROOT_PATH = path.resolve(__dirname, '..');
...
const alias = {
'~': path.join(ROOT_PATH, 'path/to/root'),
...

 

0

Is your webpack alias resolved by the IDE? What is a result of Ctrl+clicking the exportingFunction in 

import { exportingFunction } from "~/dirA/dirB/dirC/exportingModule"

 

0

Thank you! I'm new to webpack and was not sure of how it worked.

I have now pointed RubyMine to the correct webpack config file. All is working.

0

请先登录再写评论。