首页 > 解决方案 > 将 Nuxt 迁移到 2.7:刷新循环

问题描述

我正在将 Nuxt.js 项目从 迁移Nuxt@1.42.7,并根据需要更新 Webpack 配置等。我现在遇到以下错误。

当我尝试访问网站上的任何页面时,我点击了显示捆绑进度的股票 Nuxt 加载屏幕,然后立即无限刷新。应用程序永远不会越过这个屏幕,并且选项卡标题永远不会从Nuxt.js: Loading app....

控制台中没有错误,也没有任何编译时错误,但是当我转到 devtools 网络选项卡时,我看到一个失败的(HTTP 500)请求localhost:3000,并带有以下错误作为响应负载:

NuxtServerError
render function or template not defined in component: NuxtLoading

我查看了 NuxtLoading,我能找到的唯一引用是文件.nuxt夹中名为的文件nuxt-loading.vue,它看起来像一个正常运行的组件。它有一个render()方法,实现如下:

render(h) {
    let el = h(false)
    if (this.show) {
      el = h('div', {
        staticClass: 'nuxt-progress',
        class: {
          'nuxt-progress-notransition': this.skipTimerCount > 0,
          'nuxt-progress-failed': !this.canSucceed
        },
        style: {
          'width': this.percent + '%',
          'left': this.left
        }
      })
    }
    return el
  }

我试过的

提前感谢您的帮助。如果需要更多信息,请询问。

标签: javascriptvue.jsnuxt.js

解决方案


您对 i18n 加载程序的配置有误。它应该是这样的:

  config.module.rules.push({
      resourceQuery: /blockType=i18n/,
      type: 'javascript/auto',
      loader: '@kazupon/vue-i18n-loader'

  });

或者您可以使用nuxt-i18n模块,它将使用vueI18nLoader 选项为您设置。


推荐阅读