mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
fix(module): support nuxt-nightly (#3996)
This commit is contained in:
committed by
Benjamin Canac
parent
ac4c1946ec
commit
bc0a296f9d
@@ -6,6 +6,7 @@ import type { Resolver } from '@nuxt/kit'
|
|||||||
import type { ModuleOptions } from './module'
|
import type { ModuleOptions } from './module'
|
||||||
import * as theme from './theme'
|
import * as theme from './theme'
|
||||||
import colors from 'tailwindcss/colors'
|
import colors from 'tailwindcss/colors'
|
||||||
|
import { genExport } from 'knitwork'
|
||||||
|
|
||||||
export function buildTemplates(options: ModuleOptions) {
|
export function buildTemplates(options: ModuleOptions) {
|
||||||
return Object.entries(theme).reduce((acc, [key, component]) => {
|
return Object.entries(theme).reduce((acc, [key, component]) => {
|
||||||
@@ -182,9 +183,9 @@ export {}
|
|||||||
filename: 'ui-image-component.ts',
|
filename: 'ui-image-component.ts',
|
||||||
write: true,
|
write: true,
|
||||||
getContents: ({ app }) => {
|
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"'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user