动态导入 Next.js 但仍然看到 bundle 中的模块

我将组件设置为可动态调用:

index.tsx

import dynamic from "next/dynamic";
import { PhoneNumberInputProps } from "./components/PhoneNumberInput";

const PhoneNumberInput = dynamic<PhoneNumberInputProps>(
  () => import("./components/PhoneNumberInput") as any
);

组件/电话号码输入.tsx

...
import PhoneInput from "react-phone-number-input";
...

export type PhoneNumberInputProps = {...};

export const PhoneNumberInput = ({...}: PhoneNumberInputProps) => {
...
}

所以,react-phone-number-input 不应该是初始捆绑包的一部分,对吗?但是当我分析它时它仍然存在。为什么?

abxtoo 回答:动态导入 Next.js 但仍然看到 bundle 中的模块

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/384061.html

大家都在问