javascript - "TypeError: Failed to fetch dynamically imported module"上 Vue/Vite vanilla 设置

标签 javascript typescript vue.js webpack vite

我们有一个普通的 Vue/Vite 设置,我收到了 TypeError: Failed to fetch dynamically imported module在哨兵日志上。
尽管我没有足够的数据来确认,但这些错误似乎与新的 prod 部署及时相关。它不会发生在本地,仅出现在已部署的代码上。
我已经看到了一些关于 react 设置的类似问题,但没有一个得到令人满意的回应。
我还找到了 similar question regarding dynamically imported svgs ,但我们的错误发生在完整的组件上。
我们使用动态导入组件的唯一地方是路由:

export const router = createRouter({
  history: routerHistory,
  strict: true,
  routes: [
    {
      path: '/',
      name: routes.homepage.name,
      component: () => import('@/views/Home.vue'),
      children: [
        {
          path: '/overview',
          name: routes.overview.name,
          component: () => import('@/views/Overview.vue'),
        },
        // other similar routes
      ],
    },
  ],
});
我们的部门版本:
    "vue": "^3.0.9",
    "vue-router": "^4.0.5",
    "vite": "^2.0.5",
非常感谢有关此问题以及如何调试它的任何其他信息!

最佳答案

我有完全相同的问题。就我而言,有些路线有效,有些则无效。解决方案相对容易。我刚刚重新启动了开发服务器。

关于javascript - "TypeError: Failed to fetch dynamically imported module"上 Vue/Vite vanilla 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69300341/

相关文章:

javascript - Firebase 云消息传递前台通知在 Vue 中不起作用

javascript - Chrome DIV 未完全绘制

javascript - ionic 触发点击事件不起作用

javascript - 在视口(viewport)元标记中设置最小宽度

javascript - 带有 event.preventDefault 的 HTML

typescript - Visual Studio 为包含 tsconfig.json 的 node_modules 抛出错误

javascript - 如何通过循环将属性推送到数组内对象内的数组?

javascript - 掩码输入值日期格式 Angular

vue.js - 在 vue 3 : createElement is not a function 中使用 vue-chartjs

javascript - 在 ruby​​ on Rails 中渲染多个 vue 元素