Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/@vuepress/core/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ function createApp (options) {
}

async function dev (options) {
if (process.env.NODE_ENV === undefined) {
process.env.NODE_ENV = 'development'
}
const app = createApp(options)
await app.process()
return app.dev()
}

async function build (options) {
if (process.env.NODE_ENV === undefined) {
process.env.NODE_ENV = 'production'
}
const app = createApp(options)
await app.process()
return app.build()
Expand Down
3 changes: 1 addition & 2 deletions packages/@vuepress/core/lib/node/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = class App {
*/

constructor (options = {}) {
this.isProd = process.env.NODE_ENV === 'production'
this.options = options
this.sourceDir = this.options.sourceDir || path.join(__dirname, 'docs.fallback')
logger.debug('sourceDir', this.sourceDir)
Expand Down Expand Up @@ -459,7 +460,6 @@ module.exports = class App {
*/

async dev () {
this.isProd = false
this.devProcess = new DevProcess(this)
await this.devProcess.process()
const error = await new Promise(resolve => {
Expand Down Expand Up @@ -489,7 +489,6 @@ module.exports = class App {
*/

async build () {
this.isProd = true
this.buildProcess = new BuildProcess(this)
await this.buildProcess.process()
await this.buildProcess.render()
Expand Down
1 change: 0 additions & 1 deletion packages/@vuepress/core/lib/node/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const { normalizeHeadTag, applyUserWebpackConfig } = require('../util/index')
module.exports = class Build extends EventEmitter {
constructor (context) {
super()
process.env.NODE_ENV = 'production'
this.context = context
this.outDir = this.context.outDir
}
Expand Down