How can I use absolute import in express api backend?
Closed this issue · 3 comments
ZombieChibiXD commented
In nuxt .vue files, I can just use '@/path/to/component', but for some reason the same thing don't work on the express.js files..
SWDevStudio commented
I have the same problem, I can not understand how to set up the work of alias for Express files
atinux commented
Hi, at the moment aliases are not supported in server middleware, you have to use relative path.
kotvasili commented
import moduleAlias from "module-alias";
moduleAlias.addAliases({
"@": path.join(__dirname, "/../"),
});
@ZombieChibiXD This is how I solved it inside serverMiddleware folder