barbar/vortigern

non-relative imports by default

alexandr-bbm opened this issue ยท 6 comments

I have a suggestion about the default use of non-relative imports in the project. It requires only couple of lines in webpack config files but makes imports much nicer.
For example, if we add modulesDirectories: ['node_modules', 'app'], to config.resolve in /config/webpack/server.js then it will be possible to import our project files like
import { IStore } from 'redux/IStore';
instead of
import { IStore } from '../../redux/IStore';
This way it will be easier to create and refactor imports.

Nice ๐Ÿ‘

This is a great suggestion and could make imports nicer with a tiny change but last time we've discussed this we decided not to do it because some IDE's (looking at your WebStorm) were having trouble with the usage. I'm not sure if that's still the case.

@batuhan, in WebStorm you just need to mark app directory as Resource Root in order to use non-relative imports. I guess other IDE's also have such option.

I am not sure should I create PR on this?

I'm actually waiting on @altayaydemir's input, Altay?

its more than ok for me ๐Ÿ‘