Isolated learning atmosphere · v4.x
Nuxt Layers: Going Further
Based on the official Nuxt release notesA folder in layers/ proves the boundary. A package makes it real: versioned, installable, and impossible to import from by accident.
This series takes layers/learn and turns it into @vvantol2000/learn-layer — the package that serves the page you're reading — then works through everything a layer can legitimately own and the one class of bug that only appears once your layer lives in node_modules.
The relative-path trap in step three costs most people an afternoon. It fails silently in development and only breaks once the layer is consumed from somewhere else. Read that step before you publish anything.
What we cover here#
- From Folder to Workspace Package —
main,files,workspace:*, and extending by name. - What a Layer Can Own — pages, composables, server routes, and a Nuxt Content collection of its own.
- Paths, Aliases and the Trap — why
~/assets/x.cssin a layer points at the consumer's assets, and what to write instead.
Where it goes next#
- Nuxt Layers: Advanced — Advanced. Remote layers, layer vs module, testing and publishing.
- Nuxt Layers Capstone: Splitting This Blog — Advanced. The real migration, deployed.
How this series works#
Each step follows the same path: What it is → Why you'd care → Before → After → Do it yourself → Gotchas → Recap.
Prerequisite: The Basics — you should know what extends does and how precedence works.