我将组件设置为可动态调用:
索引.tsx
import dynamic from "next/dynamic";
import { PhoneNumberInputProps } from "./components/PhoneNumberInput";
const PhoneNumberInput = dynamic<PhoneNumberInputProps>(
() => import("./components/PhoneNumberInput") as any
);
组件/PhoneNumberInput.tsx
...
import PhoneInput from "react-phone-number-input";
...
export type PhoneNumberInputProps = {...};
export const PhoneNumberInput = ({...}: PhoneNumberInputProps) => {
...
}
所以,react-phone-number-input
不应该是初始捆绑包的一部分,对吧?但是当我分析它时它仍然存在。为什么?