primevue-nuxt-module icon indicating copy to clipboard operation
primevue-nuxt-module copied to clipboard

Pass object to `importPT` alongside with path

Open twisteriokovel opened this issue 9 months ago • 0 comments

I use the Primevue + Nuxt 3 + Tailwind for my project. I am working on my custom Nuxt 3 module which is responsible for setting up the project's theme. This module has a default preset but I want to have the ability to override one of the components in this preset. I want to pass it as a parameter to my module in nuxt.config file

myModule: {
    preset
}

My preset is just the object that has for example one override for button

import button from './button'
export default {
  button
}

In my module I want to have the ability to do something like

async setup(_options, _nuxt) {
  const { preset } = _options
  const presetToUse = { ...defaultPreset, ...preset }
  
  await installModule('nuxt-primevue', {
     options: {
       unstyled: true,
     },
     importPT: {
       as: 'myPreset',
       from: presetToUse, // not possible right now
     }
  })
}

Is there any workaround for it?

twisteriokovel avatar May 02 '24 17:05 twisteriokovel