External Components
So im trying to build a platform(nuxt 3) with a base template that can use external components ( build in and with nuxt 3) , from what i read it the documentation you can set a different folder to import component like :
this works like it should, the only thing is that if you use refs inside the script part in those components that are loaded from somewhere else it gived a 500 error saying ref is not defined.
is there a way to get this working without importing ref from vue ? in components that are auto imported because of the path in nuxt.config ?
also this is only happening when the folder is in node_modules
6 Replies
The issue is auto imports isn't supported within node_modules
Are you the author of the base?
yes i am the author of the base π
i kinda have it working with the component as node_module installed as package, but then again it needs the import ref from vue to work so kinda ennoying that i just want to have like vue/nuxt components lying around to use in multiple platforms but only want to touch it once ( as how you do it with making NPM packages )
as example i have
kinda found out that if you make a folder with only vue files inside node_modules
and add
in the top of the script setup
you can load the vue files from a folder in node-modules
without publishing / building
Yes you would usually ship components using the mkdist provider with unbuild
And importing from #imports is the way to go π
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
Ahh yeah ! thats exactly what im looking for
thanks @Calsyfur and @harlan