N
Nuxt7mo ago
szobi

custom modules i n Nuxt Layers

Hi, I am creating a layer that will be used in many projects. In the layer I have three modules that are responsible for, for example, syncing snippets from the backend, in general, a lot of it is based on folders and files. (modules are in the local modules folder) I have a problem because when I extend in the main project where I use this layer, it shows me that this module is missing. Is it possible to play it somehow or do the modules have to be as separate packages?
1 Reply
Dominic
Dominic7mo ago
install @nuxt/kit in your modules and use it do get defineNuxtModule and also get createResolver from it. You always need to resolve all path related things in your layer, else it will break in the extending app. Probably the problem you have. Also if you have a pnpm monorepo and the layer is a separate package and has its own deps installed, these deps are not installed/available in the extending app. If you add runtime code in your layer modules (eg. a plugin) that needs a dependency, it will fail. You must install all needed deps in your extending app too.
Want results from more Discord servers?
Add your server