Vue warnings built with webpack

The development environment is normal. When you open the console in the production environment, you will see this sentence at the top:

You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html

Translation:

You are running Vue in development mode.
When deploying to production, make sure to turn on production mode.
For more tips, please visit https://vuejs.org/guide/deployment.html

Why does it say that we are deploying in the development environment when running in the production environment? Then follow it: https://vuejs.org/guide/deployment.html

so clearly writes:

When using build tools like webpack or Browserify, the Vue source code will decide  process.env.NODE_ENV whether to enable production environment mode. The default is development environment mode.

How to configure it: People also wrote it very clearly:

My webpack version is below 4, I will try first:

  plugins: [
    new webpack.optimize.ModuleConcatenationPlugin(),
    new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /zh-cn/),
    new webpack.DefinePlugin({
      'process.env': env,
      'process.env.NODE_ENV': JSON.stringify('production'), // 就是这一句
    }),
       ...
    ]

Let's see how it works~~

Guess you like

Origin blog.csdn.net/khadijiah/article/details/99548683