[Vuejs]-Is there a way to suppress VueJS "Cannot find element" warning

0๐Ÿ‘

Iโ€™m not a Django developer, but I think maybe you can just split out them into two files or add a condition like:

const vueApp = document.querySelector('#vue-app')
if(vueApp){
  // mount the app
}

0๐Ÿ‘

Vue warnings are not emitted in the production (minified) version of Vue, so you could load vue.min.js:

new Vue({
  el: '#does_not_exist',
})
<script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>

<div id="app">
  <p>{{ message }}</p>
</div>

Leave a comment