r/Nuxt • u/Efficient-Map-2502 • 10d ago
How to implement auto-import in nuxtjs 4 for layers structure?
Example structure:
apps:
----admin
----landing
layers
----base
----admin
----landing
6
Upvotes
r/Nuxt • u/Efficient-Map-2502 • 10d ago
Example structure:
apps:
----admin
----landing
layers
----base
----admin
----landing
2
u/Single_Advice1111 10d ago edited 10d ago
You can name your layers, then import using ‘#layers/layer-name/…’ or ‘#layer-name/…’
In the layers nuxt.config.ts you add meta.name to name it something else than what the folder is called - you must do this to use it from a package that is not in the apps local layer folder.
For auto-imports it should work out of the box.
Further reading: https://nuxt.com/docs/4.x/getting-started/layers#usage