Defining directories to look in for "jump to definition"?
I'm making a React app and all the components are in a subdirectory that looks like this:
app/assets/javascripts/react
I've configured Webpack to resolve ES6 imports using:
resolved_paths: ['app/assets/javascripts/react']
so now, in my JavaScript files in the react/ directory, my imports look like this:
import SomeComponent from 'components/SomeComponent';
My issue with this is that RubyMine cannot resolve where this file is. So neither jumping to definitions nor assisting with filling in the paths works anymore. Is there somewhere where I can tell RubyMine to use app/assets/javascripts/reacts to try to resolve file locations?
Please sign in to leave a comment.
Well... RubyMine provides special support for Webpack modules resolving - namely, resolve.roots (webpack 1), resolve.module_directories (webpack 1), resolve.modules (webpack 2), resolve.alias (webpack 1/2). But
resolved_paths: []
seems to be a special feature of webpacker 3 (https://github.com/rails/webpacker) we provide no support for... So, to get your imports recognized, I can only suggest marking the react/ directory as Resource root (Mark Directory as / Resource Root)