fix(nuxi): use new builder option for vite/webpack info (#3658)

This commit is contained in:
Daniel Roe 2022-03-15 10:39:49 +00:00 committed by GitHub
parent 58a46f2270
commit a7ce6d53b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,9 +42,13 @@ export default defineNuxtCommand({
// Check nuxt version
const nuxtVersion = getDepVersion('nuxt') || getDepVersion('nuxt-edge') || getDepVersion('nuxt3') || '0.0.0'
const isNuxt3 = nuxtVersion.startsWith('3')
const useVite = isNuxt3
? nuxtConfig.vite !== false
: (nuxtConfig.buildModules?.find(m => m === 'nuxt-vite'))
const builder = isNuxt3
? nuxtConfig.builder /* latest schema */ || (nuxtConfig.vite !== false ? 'vite' : 'webpack') /* previous schema */
: nuxtConfig.bridge?.vite
? 'vite' /* bridge vite implementation */
: (nuxtConfig.buildModules?.includes('nuxt-vite')
? 'vite' /* nuxt-vite */
: 'webpack')
let packageManager = getPackageManager(rootDir)
if (packageManager) {
@ -58,7 +62,7 @@ export default defineNuxtCommand({
NodeVersion: process.version,
NuxtVersion: nuxtVersion,
PackageManager: packageManager,
Bundler: useVite ? 'Vite' : 'Webpack',
Builder: builder,
UserConfig: Object.keys(nuxtConfig).map(key => '`' + key + '`').join(', '),
RuntimeModules: listModules(nuxtConfig.modules),
BuildModules: listModules(nuxtConfig.buildModules)