I find the import path in ES6 modules very confusing when using it in Ember CLI. For example, if I want to import a model deep in my application, I end up doing something like this:
import User from '../../../../../models/user';
This is an exercise of trial and error, as it's hard to easily visualize how deep in the folder tree I'm using this from. Even worse, if I refactor my files, everything breaks.
So alternatively, I can use an absolute path like this:
import User from 'app-name/models/user';
I prefer not to hard-code the app name into the path, because it can change.
Is there a shorthand to specify the app root?
./
doesn't work because ./
implies current path.
import User from './models/user';