-
I am creating a nuxt module component library, that will be used in multiple projects, and would therefore really like to have the custom image provider in there. here is the provider from my component-library:
And the nuxt.config (partially) from a project that will use it:
Any ideas and suggestions are welcome :) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Hey there, what about adding image module to the library module that you have created and register the custom provider there? You can use the utility Example from Nuxt Security: https://github.com/nuxt-modules/security/blob/d46279ae884d5fea4431168a61a112abbd77caea/src/module.ts#L181 |
Beta Was this translation helpful? Give feedback.
-
I tried that, but couldn't make it work, but i'll try again and get back :) |
Beta Was this translation helpful? Give feedback.
-
I added this to my library module inside module.ts:
But it doen't register inside my other project I also tried adding this to the project nuxt.config:
|
Beta Was this translation helpful? Give feedback.
-
@Baroshem sorry forgot to tag you, while responding to you :) |
Beta Was this translation helpful? Give feedback.
-
Hey @momi-aura I have converted this issue into a discussion. Are you having issues with adding a custom module to the main nuxt project or with the fact that the custom provider is not registered properly? Does this custom provider work if you try it in the module playground? Is the module published as an external npm package or is it just local module? |
Beta Was this translation helpful? Give feedback.
Hi @Baroshem
I found a "solution". But forgot to update this :)
I added
addImportsDir(resolve(runtimeDir, 'providers'))
to my module.ts. And now i can use the custom provider like this:So it somewhat solves the issue i was having, i would however have prefered if it was possible for me to register the provider inside my module, and then just use it directly inside my other projects :)