nuxt-community/express-template

How can I use absolute import in express api backend?

Closed this issue · 3 comments

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..

I have the same problem, I can not understand how to set up the work of alias for Express files

Hi, at the moment aliases are not supported in server middleware, you have to use relative path.

import moduleAlias from "module-alias";

moduleAlias.addAliases({
  "@": path.join(__dirname, "/../"),
});

@ZombieChibiXD This is how I solved it inside serverMiddleware folder