在Next.js 13中导入wagmi包的应用程序目录中出现错误:包路径./dist/chains未从包中导出

rfbsl7qr  于 2023-08-04  发布在  其他
关注(0)|答案(1)|浏览(117)

Next.js 13,带有客户端组件的应用程序目录。我在进口安全帽时遇到了问题。


的数据
组件代码:

"use client";

import { Faucet } from "./scaffold-eth";
import { hardhat } from "wagmi/dist/chains";
import { CurrencyDollarIcon } from "@heroicons/react/24/outline";
import { useGlobalState } from "~~/services/store/store";
import { getTargetNetwork } from "~~/utils/scaffold-eth";

export default function NativeCurrencyPrice() {
  const nativeCurrencyPrice = useGlobalState(state => state.nativeCurrencyPrice);

  return (
    <div className="flex space-x-2 pointer-events-auto">
      {nativeCurrencyPrice > 0 && (
        <div className="btn btn-primary btn-sm font-normal cursor-auto">
          <CurrencyDollarIcon className="h-4 w-4 mr-0.5" />
          <span>{nativeCurrencyPrice}</span>
        </div>
      )}
      {getTargetNetwork().id === hardhat.id && <Faucet />}
    </div>
  );
}

字符串

cs7cruho

cs7cruho1#

我使用自动导入导致错误的路径。
代替该路径

import { hardhat } from "wagmi/dist/chains";

字符串
使用此路径

import { hardhat } from "wagmi/chains";

相关问题