mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): ignore falsy modules (#19684)
This commit is contained in:
parent
53d902ad5e
commit
ce575b49e3
@ -132,7 +132,7 @@ export const schemaTemplate: NuxtTemplate<TemplateContext> = {
|
||||
...modules.map(([configKey, importName]) =>
|
||||
` [${configKey}]?: typeof ${genDynamicImport(importName, { wrapper: false })}.default extends NuxtModule<infer O> ? Partial<O> : Record<string, any>`
|
||||
),
|
||||
modules.length > 0 ? ` modules?: (NuxtModule | string | [NuxtModule | string, Record<string, any>] | ${modules.map(([configKey, importName]) => `[${genString(importName)}, Exclude<NuxtConfig[${configKey}], boolean>]`).join(' | ')})[],` : '',
|
||||
modules.length > 0 ? ` modules?: (undefined | null | false | NuxtModule | string | [NuxtModule | string, Record<string, any>] | ${modules.map(([configKey, importName]) => `[${genString(importName)}, Exclude<NuxtConfig[${configKey}], boolean>]`).join(' | ')})[],` : '',
|
||||
' }',
|
||||
generateTypes(await resolveSchema(Object.fromEntries(Object.entries(nuxt.options.runtimeConfig).filter(([key]) => key !== 'public'))),
|
||||
{
|
||||
|
@ -194,9 +194,11 @@ export default defineUntypedSchema({
|
||||
* function () {}
|
||||
* ]
|
||||
* ```
|
||||
* @type {(typeof import('../src/types/module').NuxtModule | string | [typeof import('../src/types/module').NuxtModule | string, Record<string, any>])[]}
|
||||
* @type {(typeof import('../src/types/module').NuxtModule | string | [typeof import('../src/types/module').NuxtModule | string, Record<string, any>] | undefined | null | false)[]}
|
||||
*/
|
||||
modules: [],
|
||||
modules: {
|
||||
$resolve: val => [].concat(val).filter(Boolean)
|
||||
},
|
||||
|
||||
/**
|
||||
* Customize default directory structure used by Nuxt.
|
||||
|
@ -1 +1,3 @@
|
||||
export default defineNuxtConfig({})
|
||||
export default defineNuxtConfig({
|
||||
modules: [undefined]
|
||||
})
|
||||
|
4
test/fixtures/basic/nuxt.config.ts
vendored
4
test/fixtures/basic/nuxt.config.ts
vendored
@ -135,7 +135,9 @@ export default defineNuxtConfig({
|
||||
function (_, nuxt) {
|
||||
nuxt.options.optimization.treeShake.composables.server[nuxt.options.rootDir] = ['useClientOnlyComposable', 'setTitleToPink']
|
||||
nuxt.options.optimization.treeShake.composables.client[nuxt.options.rootDir] = ['useServerOnlyComposable']
|
||||
}
|
||||
},
|
||||
// To test falsy module values
|
||||
undefined
|
||||
],
|
||||
vite: {
|
||||
logLevel: 'silent'
|
||||
|
Loading…
Reference in New Issue
Block a user