WebStormRequireJsPlugin icon indicating copy to clipboard operation
WebStormRequireJsPlugin copied to clipboard

Resolve config path to a file outside of the project

Open prantlf opened this issue 10 years ago • 0 comments

I use requirejs modules from multiple libraries. The libraries expose their modules using a path prefix, which can be configured to map all modules from a particular library to a single root. Applications and libraries have their own projects, which do not have a common root directory, but it is helpful to be able to use the "Go To Location" feature for modules from other than currently edited component.

// file configured for the Require.js config file path
require.config({
  paths: {
    core: '../../core/src',
    recman: '../../recman/src',
    app: '.'
  }
});

// Example of a module from the app project
define([
  'core/model/node', 'recman/model/hold, 'app/view/manager'
], function (NodeModel, HoldModel, ManagerView) {
  ...
});

Paths to the modules app/... are resolved well and "Go To Location" opens them. Paths to the modules core/... and recman/... are not. I tried to create symlinks to their directories in the app project root and they started to work, which made me believe that the module path resolution is somehow limited to the current project root. However, why creating a symlink even with an unrelated name fixes this? I can open a file from any path in WebStorm too. Is it possible to resolve the module paths also to directories outside the current project root? Thanks!

prantlf avatar May 17 '14 16:05 prantlf