When using AMRI CLI, the import path in ES6 modules is very confusing. For example, if I want to import a model deep in my application, then I end up doing something like this:
' ../../ .. /../ ./models/user ';
This is a test of error and error, because it easily imagines how deep I am using it in the folder tree. Even worse, if I reorganize my files, everything is broken.
Therefore, I can use a complete path like this:
'app-name / model / user' by user name;
I do not like the app name on the hard-coded path, because it can change.
Is there any cloak to specify the application root?
./
does not work because ./
means the current path.
Import user from './models/user'; Unfortunately for programming, there is no way to import at least ES6 in Amber, so you can. 'Do not use ENV.modulePrefix
. Although there is an alternative solution. Whenever you want to change the module prefix, then run the GNU sed command from ZSH inside the amber root. Previous>
No comments:
Post a Comment