From 6366118709a610ce48c3862478998a2d1c9200d6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 28 Apr 2025 09:43:22 +0100 Subject: [PATCH] fix(module): support `nuxt-nightly` (#3996) --- src/templates.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/templates.ts b/src/templates.ts index cbe8c0f4..d09e5daa 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -6,6 +6,7 @@ import type { Resolver } from '@nuxt/kit' import type { ModuleOptions } from './module' import * as theme from './theme' import colors from 'tailwindcss/colors' +import { genExport } from 'knitwork' export function buildTemplates(options: ModuleOptions) { return Object.entries(theme).reduce((acc, [key, component]) => { @@ -182,9 +183,9 @@ export {} filename: 'ui-image-component.ts', write: true, getContents: ({ app }) => { - const image = app?.components?.find(c => c.pascalName === 'NuxtImg' && !c.filePath.includes('nuxt/dist/app')) + const image = app?.components?.find(c => c.pascalName === 'NuxtImg' && !/nuxt(?:-nightly)?\/dist\/app/.test(c.filePath)) - return image ? `export { default } from "${image.filePath}"` : 'export default "img"' + return image ? genExport(image.filePath, [{ name: image.export, as: 'default' }]) : 'export default "img"' } })