vue-wp-starter icon indicating copy to clipboard operation
vue-wp-starter copied to clipboard

Cannot deploy as production

Open vdiaza opened this issue 6 years ago • 2 comments

I cannot stop getting this message on the front end & admin.

"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"

I have tried using the "npm run build", but it doesn't make any difference.

Any clue of what could be happening?

vdiaza avatar Jan 10 '19 05:01 vdiaza

As per vue documentation, production is defined with webpack using this line

module.exports = {
  mode: 'production'
}

In webpack.config.js you can see the environment variable is set up by this line

var env = process.env.WEBPACK_ENV;

So I'd suggest trying to set up you process.ebv file to the WEBPACK_ENV variable is set to production

VUEJS Documentation for ENV file

https://cli.vuejs.org/guide/mode-and-env.html

francoisauclair911 avatar Jan 14 '19 18:01 francoisauclair911

I was having a same problem when npm run build won't build in Production Mode. Take a look at this page https://vuejs.org/v2/guide/deployment.html . This repo comes with webpack 3.11 so follow the instructions for webpack 3 and earlier.

I edited var plugins = [] inside webpack.config.js to

var plugins = [
    new webpack.DefinePlugin({
        'process.env.NODE_ENV': JSON.stringify('production')
      })
];

This way you always deploy in Production Mode.

vrerabek avatar May 01 '19 10:05 vrerabek