0

问题:

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
4

1 回答 1

0

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

于 2021-06-23T14:48:09.690 回答