Imports in Nuxt Layers
When dealing with imports in Nuxt layers, some ways work sometimes, other ways don’t work at all, and one way works all the time. Learn the best method for writing import statements in Nuxt layers so that it works everywhere.
The Nuxt layer import alias #layers/[layer-name]
was introduced in Nuxt v3.16.0 and makes importing layer JS/TS modules intuitive and type-safe in both the layer source code and the consuming app.
Links
- Chapter 2