fix(nuxt): add @nuxt/devtools module before core modules (#20595)

This commit is contained in:
Anthony Fu 2023-04-30 11:06:43 +02:00 committed by GitHub
parent 9b956c9689
commit a13b18eddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -358,6 +358,17 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Temporary until finding better placement for each
options.appDir = options.alias['#app'] = resolve(distDir, 'app')
options._majorVersion = 3
// Nuxt DevTools is currently opt-in
if (options.devtools === true || (options.devtools && options.devtools.enabled !== false)) {
if (await import('./features').then(r => r.ensurePackageInstalled(options.rootDir, '@nuxt/devtools', options.modulesDir))) {
options._modules.push('@nuxt/devtools')
} else {
logger.warn('Failed to install `@nuxt/devtools`, please install it manually, or disable `devtools` in `nuxt.config`')
}
}
// Add core modules
options._modules.push(pagesModule, metaModule, componentsModule)
options._modules.push([importsModule, {
transform: {
@ -376,15 +387,6 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
options._modules.push('@nuxt/telemetry')
}
// Nuxt DevTools is currently opt-in
if (options.devtools === true || (options.devtools && options.devtools.enabled !== false)) {
if (await import('./features').then(r => r.ensurePackageInstalled(options.rootDir, '@nuxt/devtools', options.modulesDir))) {
options._modules.push('@nuxt/devtools')
} else {
logger.warn('Failed to install `@nuxt/devtools`, please install it manually, or disable `devtools` in `nuxt.config`')
}
}
const nuxt = createNuxt(options)
if (nuxt.options.debug) {