You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the past I used Nuxt extensively, now I am also using Nitro by itself to build a standalone server. The Nuxt/Nitro configs are quite similar. The defineNitroConfig takes an input with type NitroConfig which extends NitroOptions. We have the option to set an alias which is described in the docs here. For Nuxt there is a similar option but the docs are different though.
Goal
My expectation would be that the configs work in the same way. I should be able to put aliases in the Nitro config and they are put to the .nitro/types/tsconfig.json under compilerOptions.paths like Nuxt does.
Findings
I found out that I can achieve the desired behaviour by setting both alias and tsConfig.compilerOptions. Example:
At least I hope that this recreates the same behaviour, first tests look good. In Nuxt it is not necessary to also set the typescript.tsConfig part.
Solution
In the perfect world both configs behave the same way. I cannot really assess which implications a change of the Nitro config has. Can we connect alias/typescript settings? For me also an extension/adjustment of the Nitro docs would be ok, since I needed quite some time and digging to figure out how to configure Nitro correctly (assuming the finding above is correct). Anyways I would be open to contribute/suggest a change.
Describe the feature
Context
In the past I used Nuxt extensively, now I am also using Nitro by itself to build a standalone server. The Nuxt/Nitro configs are quite similar. The
defineNitroConfig
takes an input with typeNitroConfig
which extendsNitroOptions
. We have the option to set analias
which is described in the docs here. For Nuxt there is a similar option but the docs are different though.Goal
My expectation would be that the configs work in the same way. I should be able to put aliases in the Nitro config and they are put to the
.nitro/types/tsconfig.json
under compilerOptions.paths like Nuxt does.Findings
I found out that I can achieve the desired behaviour by setting both alias and tsConfig.compilerOptions. Example:
At least I hope that this recreates the same behaviour, first tests look good. In Nuxt it is not necessary to also set the typescript.tsConfig part.
Solution
In the perfect world both configs behave the same way. I cannot really assess which implications a change of the Nitro config has. Can we connect alias/typescript settings? For me also an extension/adjustment of the Nitro docs would be ok, since I needed quite some time and digging to figure out how to configure Nitro correctly (assuming the finding above is correct). Anyways I would be open to contribute/suggest a change.
Related
Additional information
The text was updated successfully, but these errors were encountered: