ant-design / ant-design-icons

⭐ Ant Design SVG Icons
https://ant.design/components/icon/
MIT License
939 stars 577 forks source link

Cannot use import statement outside a module #619

Open hqwlkj opened 5 months ago

hqwlkj commented 5 months ago

image

Next.js

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 20.6.0: Thu Jul  6 22:12:47 PDT 2023; root:xnu-7195.141.49.702.12~1/RELEASE_X86_64
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 7.16.0
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: standalone

antd


"@ant-design/icons": "^5.2.6",
"antd": "^5.13.1",
hqwlkj commented 4 months ago

image

Next.js

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 20.6.0: Thu Jul  6 22:12:47 PDT 2023; root:xnu-7195.141.49.702.12~1/RELEASE_X86_64
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 7.16.0
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: standalone

antd


"@ant-design/icons": "^5.2.6",
"antd": "^5.13.1",

@afc163 可以帮忙看看什么原因吗?

blackMoja commented 4 months ago

I have same issue. Is this issue still unresolved?

antd

"@ant-design/icons": "^5.3.0",
"antd": "^5.14.1",
kkk360 commented 4 months ago

If you are using nextjs 14, You can modify the next.config.js file, add const nextConfig = { ... , transpilePackages: ["@ant-design/icons"], }

blackMoja commented 2 months ago

@kkk360 Thanks. It works :) Is that in the official document?