Blank screen and Vue warning with hot reloading
Version
3.2.13
Reproduction link
Steps to reproduce
- Clone attached repo and run
npm install
. - Run
npm run serve
. - Open the app in the browser. You should see a page that says "Hello World!".
- Open
App.vue
and save the file. - Observe that the browser page is now blank and there is a warning in the console that says
[Vue warn]: Component is missing template or render function. at <App>
What is expected?
I would expect the app to still show up and for there to be no warning.
What is actually happening?
The app disappears and there is a warning.
Other devs on the Vue forum are running into this issue: https://forum.vuejs.org/t/vue-3-fresh-project-hot-reload-resulting-in-component-is-missing-template-or-render-function/121884
This is a regression caused by vue-loader@16.6+
. For now, please pin vue-loader to 16.5.x (e.g. using Yarn's resolution field)
应该固定在
vue-loader@16.8.1
. 我固定在vue-loader@16.8.1
无效,还是报这警告,并且页面空白。这是我package-lock.json的截图: 以及查看node_modules文件夹下安装的vue-loader的package.json截图:
When is a vue-loader version bump in @vue/cli-service expected @yyx990803 ? I'm afraid that there's no straightforward solution for npm as for yarn (except downgrading)
@long-hai-yang @Sun3 You can refer to this answer https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions
It's working again for me...
I reinstalled vue cli via npm install -g u/vue/cli
then deleted my projects package-lock.json
file. Then from the project, I ran npm install
and the hot reload is working again.
still blank screen when use vue-loader 16.8.1,and console warn Component is missing template or render function
I find that when making changes to components that have a v-if
or v-show
condition on them (for example a dropdown menu), and I make some changes to a nested component, this will hot-reload fine when the component is visible. But if I then toggle the visibility of the parent component to hide it and then show it again, Vue will render an empty component.
Only fix is to refresh the page.
Not sure if it is the same issue as the one described here, as there is no error in the console, but it's a similar problem and also requires a refresh to fix it.
Should be fixed in
vue-loader@16.8.1
.
But, when I use vue-loader@17.0.0, it still warns.