How do I turn off the productionTip warning in Vue 3?
·
Answer a question
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@next"></script>
<div id="app">{{ foo }}</div>
Answers
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>
更多推荐

所有评论(0)