Nuxt is a good framework.
I've been using it for a few months now and it's good, but I found some limitations that were annoying for a professional use.
Layers & modules
Nuxt's Layers and modules allows you to split your code as reusable parts.
- a layer for your shared UI components
- a layer for your auth system
- ...
But each layer can requires specific packages for it's business.
Limitation
- With Nuxt <= 3.11.1 at least
- Using layer/module linked on github or so.
If your layers/modules requires dependencies to work, Nuxt will not install these dependencies on npm install
or npm build
on your projects and you won't be able to run em.
Documentation is very poor and unclear about theses two features.
Workaround
I tested a lot of tricks, asked the community but there is no workaround for now except manually install your layers'/modules' dependencies into each one of your projects.
It's very limitative and annoying if you want to use your layers/modules on several projects and this make it loses all the interest of these features: easy reusability.
In my opinion, layers and modules are most of time useless in this state.
Keep this in mind before starting a big and professional project with it. 😣
Top comments (2)
Hey, i wonder if adding these dependencies in a package.json's
peerDependencies
would work? You'll just have to usepnpm i
after extending some layer. What do you think?Hey!
I tested it and it's not working.
I use the feature to extend layer from a distant GIT repo.
In this case the layer is not installed as an npm package but cloned from repo by
unjs/giget
in/myProject/node_modules/.c12/github_myLayerRepo_xxx
and it's dependencies are not installed.Thank you for the tip anyway :)
It's not practical nor what I want but I'll publish my layer as an npm package. It should work considering the Nuxt3 documentation.