fix: add better logs for DX with target option (#8206)

* fix: add better logs for DX with target option

* chore: add warning for old nuxt build in ssr false

* Update generator.js

* Update generate.js

* chore: better logs

* fix: update
This commit is contained in:
Sébastien Chopin 2020-10-15 18:12:06 +02:00 committed by GitHub
parent 044d07cb17
commit 7e7190b90d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -24,8 +24,7 @@ import {
stripWhitespace,
isIndexFileAndFolder,
scanRequireTree,
TARGETS,
isFullStatic
TARGETS
} from '@nuxt/utils'
import Ignore from './ignore'
@ -130,8 +129,7 @@ export default class Builder {
} else {
consola.info(`Bundling only for ${chalk.bold.green('client')} side`)
}
const target = isFullStatic(this.options) ? 'full static' : this.options.target
consola.info(`Target: ${chalk.bold.cyan(target)}`)
consola.info(`Target: ${chalk.bold.cyan(this.options.target)}`)
}
// Wait for nuxt ready

View File

@ -1,4 +1,5 @@
import { TARGETS } from '@nuxt/utils'
import consola from 'consola'
import { common, locking } from '../options'
import { normalizeArg, createLock } from '../utils'
import { ensureBuild, generate } from '../utils/generate'
@ -75,6 +76,7 @@ export default {
// Forcing static target anyway
config.target = TARGETS.static
consola.warn(`For using \`nuxt generate\`, your have to set \`target: 'static'\` in your \`nuxt.config\`\n 👉 Learn more about it on https://go.nuxtjs.dev/static-target`)
// Set flag to keep the prerendering behaviour
config._legacyGenerate = true

View File

@ -16,6 +16,9 @@ export default class Generator {
// Set variables
this.isFullStatic = isFullStatic(this.options)
if (this.isFullStatic) {
consola.info(`Full static generation activated`)
}
this.staticRoutes = path.resolve(this.options.srcDir, this.options.dir.static)
this.srcBuiltPath = path.resolve(this.options.buildDir, 'dist', 'client')
this.distPath = this.options.generate.dir