Path alias for server routes not resolving correctly with layer feature. #27298
Unanswered
azoom-y-ishii
asked this question in
Questions
Replies: 1 comment
-
https://nuxt.com/docs/guide/going-further/layers#relative-paths-and-aliases Either Or... try the experimental https://nuxt.com/docs/guide/going-further/experimental-features#locallayeraliases. I just found about all this. I haven't played with layers yet. Subscribed to learn more. 👀 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using the Layer feature, but while the '@' path alias resolves correctly in components, it doesn't work in Server Routes.
Here is a minimal reproduction:
https://stackblitz.com/edit/nuxt-starter-d6xolj
This project extends the my-layer folder as a layer. In
my-layer/components/HelloWorld.vue
,import { message } from '@/constants/foo'
imports without any error, but inserver/api/ng.get.ts
, it causes an error.To resolve this issue, I have created the following alias, which works correctly in
server/api/ok.get.ts
:Is this error the expected behavior of Nuxt? It seems odd that it only occurs with Server Routes.
Beta Was this translation helpful? Give feedback.
All reactions