'How to switch Vue.js to production mode in Laravel?

Since Vue.js is comes already installed in Laravel, I'm not sure how to set it to production mode.

When I launch my website I get the message in console:

You are running Vue in development mode. Make sure to turn on production mode when deploying for production.



Solution 1:[1]

Just build your assets using “npm run production”

Solution 2:[2]

Method 1

npm run production

Method 2 In Laravel, add an environment variable in laravel configuration and based on the load the Vue configurations in the run time.

Define: MIX_ENV_MODE=production

Usage: process.env.MIX_ENV_MODE

And finally, add this code in any of your configuration script files

if (process.env.MIX_ENV_MODE === 'production') {
    Vue.config.devtools = false;
    Vue.config.debug = false;
    Vue.config.silent = true; 
}

Solution 3:[3]

setup Manual app.js before new Vuew

Vue.config.productionTip = true
Vue.config.devtools = true;
Vue.config.debug = true;
Vue.config.silent = true; 

Using npm prod/dev

"npm run prod / production"
"npm run dev / watch" 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thiago Barcala
Solution 2 ptheodosiou
Solution 3 Carlos