mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat(schema): allow configuring type hoists with typescript.hoist
This commit is contained in:
parent
9d08cdfd1f
commit
85166cced7
@ -63,7 +63,7 @@ async function initNuxt (nuxt: Nuxt) {
|
||||
nuxtCtx.set(nuxt)
|
||||
nuxt.hook('close', () => nuxtCtx.unset())
|
||||
|
||||
const coreTypePackages = ['nitropack', 'defu', 'h3', '@unhead/vue', 'vue', 'vue-router', '@nuxt/schema']
|
||||
const coreTypePackages = nuxt.options.typescript.hoist || []
|
||||
const paths = Object.fromEntries(await Promise.all(coreTypePackages.map(async (pkg) => {
|
||||
const path = await _resolvePath(pkg, { url: nuxt.options.modulesDir }).then(r => resolvePackageJSON(r)).catch(() => null)
|
||||
if (!path) { return }
|
||||
|
@ -26,6 +26,17 @@ export default defineUntypedSchema({
|
||||
$resolve: val => val ?? null
|
||||
},
|
||||
|
||||
/**
|
||||
* Modules to generate deep aliases for within `compilerOptions.paths`. This does not yet support subpaths.
|
||||
* It may be necessary when using Nuxt within a pnpm monorepo with `shamefully-hoist=false`.
|
||||
*/
|
||||
hoist: {
|
||||
$resolve: (val) => {
|
||||
const defaults = ['nitropack', 'defu', 'h3', '@unhead/vue', 'vue', 'vue-router', '@nuxt/schema']
|
||||
return val === false ? [] : (Array.isArray(val) ? val.concat(defaults) : defaults)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user