【问题标题】:NextJS Dynamic SSR: False stuck on loading in Mobile DevicesNextJS 动态 SSR:错误卡在移动设备中加载
【发布时间】:2021-06-22 06:37:42
【问题描述】:

问题:

Next JS 动态导入在移动设备浏览器上加载时卡住了(使用的浏览器:IOS 上的 Google Chrome 和 Safari。)而它在桌面上的 Google Chrome 和 Mozilla 上运行良好。我也在默认配置上使用 next-PWA。会不会是因为 next-PWA?

代码片段:

import dynamic from "next/dynamic";
import { useMemo } from "react";

export default function Main() {

const Component = useMemo(
    () =>
      dynamic(() => import("@components/Component"), {
        loading: () => <p>The component is loading</p>,
        ssr: false,
      }),
    [],
  );

  return(<div><Component/></div>);
}

在移动设备上输出

The component is loading

桌面浏览器上的输出

Hello from Component

【问题讨论】:

    标签: javascript typescript next.js next-pwa


    【解决方案1】:

    故障不在于 Next Dynamic,而是由于 HTTP 站点未在移动浏览器中获取导航器资源。

    【讨论】:

      猜你喜欢
      • 2019-07-09
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 2022-12-01
      • 1970-01-01
      • 2016-12-27
      • 1970-01-01
      • 2017-02-26
      相关资源
      最近更新 更多