Skip to content

Commit

Permalink
fix(types): inject content types to server tsConfig
Browse files Browse the repository at this point in the history
resolves #2968
  • Loading branch information
farnabaz committed Jan 15, 2025
1 parent 5e12ce1 commit 203ac90
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { hash } from 'ohash'
import { join, dirname, isAbsolute } from 'pathe'
import htmlTags from '@nuxtjs/mdc/runtime/parser/utils/html-tags-list'
import { kebabCase, pascalCase } from 'scule'
import defu from 'defu'
import { version } from '../package.json'
import { generateCollectionInsert, generateCollectionTableDefinition } from './utils/collection'
import { componentsManifestTemplate, contentTypesTemplate, fullDatabaseRawDumpTemplate, manifestTemplate, moduleTemplates } from './utils/templates'
Expand Down Expand Up @@ -139,11 +140,16 @@ export default defineNuxtModule<ModuleOptions>({

// Add Templates & aliases
nuxt.options.nitro.alias = nuxt.options.nitro.alias || {}
addTypeTemplate(contentTypesTemplate(manifest.collections))
addTemplate(fullDatabaseRawDumpTemplate(manifest))
nuxt.options.alias['#content/components'] = addTemplate(componentsManifestTemplate(manifest)).dst
nuxt.options.alias['#content/manifest'] = addTemplate(manifestTemplate(manifest)).dst

// Add content types to Nuxt and Nitro
const typesTemplateDst = addTypeTemplate(contentTypesTemplate(manifest.collections)).dst
nuxt.options.nitro.typescript.tsConfig = defu(nuxt.options.nitro.typescript.tsConfig, {
include: [typesTemplateDst],
})

// Register user components
const _layers = [...nuxt.options._layers].reverse()
for (const layer of _layers) {
Expand Down

0 comments on commit 203ac90

Please sign in to comment.