fix(nuxi): don't include nuxt3 for bridge projects (#663)

This commit is contained in:
Daniel Roe 2021-10-05 22:49:56 +02:00 committed by GitHub
parent 0213adcd20
commit 485c97645a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import { promises as fsp } from 'fs' import { promises as fsp } from 'fs'
import { relative, resolve } from 'pathe' import { relative, resolve } from 'pathe'
import { cyan } from 'colorette' import { cyan } from 'colorette'
import type { TSReference } from '@nuxt/kit' import { isNuxt3, TSReference } from '@nuxt/kit'
import { importModule, getModulePaths, getNearestPackage } from '../utils/cjs' import { importModule, getModulePaths, getNearestPackage } from '../utils/cjs'
import { success } from '../utils/log' import { success } from '../utils/log'
import { defineNuxtCommand } from './index' import { defineNuxtCommand } from './index'
@ -19,14 +19,14 @@ export default defineNuxtCommand({
const { loadNuxt } = await importModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit') const { loadNuxt } = await importModule('@nuxt/kit', rootDir) as typeof import('@nuxt/kit')
const nuxt = await loadNuxt({ rootDir }) const nuxt = await loadNuxt({ rootDir })
const adHocModules = nuxt.options._majorVersion === 3 const adHocModules = isNuxt3()
? ['@nuxt/kit', '@nuxt/nitro'] ? ['@nuxt/kit', '@nuxt/nitro']
: ['@nuxt/kit'] : ['@nuxt/kit']
const modulePaths = getModulePaths(nuxt.options.modulesDir) const modulePaths = getModulePaths(nuxt.options.modulesDir)
const references: TSReference[] = [ const references: TSReference[] = [
'nuxt3', ...isNuxt3() ? ['nuxt3'] : [],
...adHocModules, ...adHocModules,
...nuxt.options.buildModules, ...nuxt.options.buildModules,
...nuxt.options.modules, ...nuxt.options.modules,