tao
tao

Reputation: 90188

How do I turn off the productionTip warning in Vue 3?

In Vue 2 one could use

Vue.config.productionTip = false;

to turn off the productionTip warning on development builds. However it doesn't work with Vue 3:

Vue.config && (Vue.config.productionTip = false);

const App = {
  data: () => ({
    foo: 'bar'
  })
};
Vue.createApp(App).mount('#app');
<script src="https://unpkg.com/vue@3"></script>
<div id="app">{{ foo }}</div>

Upvotes: 14

Views: 20543

Answers (3)

MAW
MAW

Reputation: 973

productionTip has been defaulted to false for production in Vue 3.x. It's now only for dev. Check Vuejs official documentation.

Upvotes: 7

tao
tao

Reputation: 90188

According to documentation it was removed.

So, if you want to get rid of the warning in your Vue 3 Stack Overflow answers (without disabling the console in the snippet), you have to replace src="https://unpkg.com/vue" with a global.prod CDN build: (i.e: src="https://unpkg.com/vue/dist/vue.global.prod.js"):

const App = {
  data: () => ({
    foo: 'bar'
  })
};
Vue.createApp(App).mount('#app');
<script src="https://unpkg.com/vue/dist/vue.global.prod.js"></script>
<div id="app">{{ foo }}</div>

Upvotes: 11

mazdak
mazdak

Reputation: 185

write this


const app = createApp(App)

app.config.warnHandler = function (msg, vm, trace) {
  return null
}

Done!

Upvotes: 1

Related Questions