fix(templates): pass options to theme in dev mode

This commit is contained in:
Benjamin Canac
2024-06-07 19:54:48 +02:00
parent 5511e21eeb
commit 5694823a41

View File

@@ -303,7 +303,7 @@ export function addTemplates(options: ModuleOptions, nuxt: Nuxt) {
if (process.env.DEV) {
return [
`import template from ${JSON.stringify(fileURLToPath(new URL(`./theme/${kebabCase(component)}`, import.meta.url)))}`,
`const result = typeof template === 'function' ? template(${JSON.stringify({ colors: options.colors })}) : template`,
`const result = typeof template === 'function' ? template(${JSON.stringify(options)}) : template`,
`export default result`,
`/* export default ${json} */`
].join('\n')