mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
Add process.generate
This commit is contained in:
parent
e510136a5a
commit
42d967c27b
@ -27,6 +27,7 @@ export default class Builder extends Tapable {
|
||||
constructor (nuxt) {
|
||||
super()
|
||||
this.nuxt = nuxt
|
||||
this.generate = false // Flag to know if the build is for a generated app
|
||||
this.options = nuxt.options
|
||||
|
||||
// Fields that set on build
|
||||
@ -88,6 +89,10 @@ export default class Builder extends Tapable {
|
||||
})
|
||||
}
|
||||
|
||||
forGenerate() {
|
||||
this.generate = true
|
||||
}
|
||||
|
||||
async build () {
|
||||
// Avoid calling build() method multiple times when dev:true
|
||||
/* istanbul ignore if */
|
||||
|
@ -31,7 +31,8 @@ export default class Generator extends Tapable {
|
||||
await this.nuxt.ready()
|
||||
|
||||
// Start build process
|
||||
if (this.builder && build) {
|
||||
if (build) {
|
||||
this.builder.forGenerate() // Add flag to set process.generate
|
||||
await this.builder.build()
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,8 @@ export default function webpackClientConfig () {
|
||||
'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV || (this.options.dev ? 'development' : 'production')),
|
||||
'process.env.VUE_ENV': JSON.stringify('client'),
|
||||
'process.browser': true,
|
||||
'process.server': false
|
||||
'process.server': false,
|
||||
'process.generate': this.generate
|
||||
}))
|
||||
)
|
||||
|
||||
|
@ -44,7 +44,8 @@ export default function webpackServerConfig () {
|
||||
'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV || (this.options.dev ? 'development' : 'production')),
|
||||
'process.env.VUE_ENV': JSON.stringify('server'),
|
||||
'process.browser': false,
|
||||
'process.server': true
|
||||
'process.server': true,
|
||||
'process.generate': this.generate
|
||||
}))
|
||||
])
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user