diff --git a/packages/@vuepress/core/lib/index.js b/packages/@vuepress/core/lib/index.js
index 85afa96123..09dec97807 100644
--- a/packages/@vuepress/core/lib/index.js
+++ b/packages/@vuepress/core/lib/index.js
@@ -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()
diff --git a/packages/@vuepress/core/lib/node/App.js b/packages/@vuepress/core/lib/node/App.js
index e21c8ce29b..46d6b0914b 100755
--- a/packages/@vuepress/core/lib/node/App.js
+++ b/packages/@vuepress/core/lib/node/App.js
@@ -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)
@@ -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 => {
@@ -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()
diff --git a/packages/@vuepress/core/lib/node/build/index.js b/packages/@vuepress/core/lib/node/build/index.js
index b405108a32..19ffc11e6d 100644
--- a/packages/@vuepress/core/lib/node/build/index.js
+++ b/packages/@vuepress/core/lib/node/build/index.js
@@ -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
   }