antd引入问题

来源:3-3 导航样式调整

慕先生9198790

2023-11-23

  1. 原先我使用老师的方式 npm install antd --save ,引入@import 'antd/dist/antd.css'; 的时候报错.

报错信息如下:https://img1.sycdn.imooc.com/szimg/655f5e3809225a8a15850822.jpg



2. 然后我尝试使用官网的next下载方法,链接如下:

 https://ant-design.antgroup.com/docs/react/use-with-next-cn


https://img1.sycdn.imooc.com/szimg/655f5be4096a9f7c07520269.jpg


https://img1.sycdn.imooc.com/szimg/655f5bf409edd30308770826.jpg



依旧报错

Server Error
SyntaxError: Cannot use import statement outside a module
This error happened while generating the page. Any console logs will be displayed in the terminal window.



写回答

1回答

Tomas

2023-11-24

是不是装的 antd5 啊,antd5 修改了打包方式,课程用的应该是 antd4 的版本
0
4
Tomas
回复
慕先生9198790
课程录制的时候next还是老版本,最近应该是更新新版本了
2023-11-27
共4条回复

Next.js+React+Node系统实战,搞定SSR服务器渲染

Next.js+React+Node系统实战,搞定SSR服务器渲染

421 学习 · 144 问题

查看课程