-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next.js 引入 antd 报错 SyntaxError: Cannot use import statement outside a module #8400
Comments
pages/index.tsx代码: ` import React from "react"; import styles from '@/styles/page.module.css' const Pages: React.FC = () => { 助开发者「更 轻松」地搭建~ So # 组件库<Button type={"primary"}>start coding ) }; export default Pages package.json 文件 ` ` |
提错位置了? 这是 |
好的,感谢回话
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 发送日期 | 2024年05月10日 16:30 |
| 收件人 | ant-design/pro-components ***@***.***> |
| 抄送人 | SojinLab ***@***.***>,
Author ***@***.***> |
| 主题 | Re: [ant-design/pro-components] next.js 引入 antd 报错 SyntaxError: Cannot use import statement outside a module (Issue #8400) |
提错位置了? 这是 pro-components, 不是 antd
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
问题: next.js 引入 antd 报错 SyntaxError:无法在模块外使用导入语句
代码:
pagejson版本 {"name": "next-app","版本": "0.1.0",“私人”:真的,"类型": "模块","脚本": {"dev": "下一个dev","构建": "下一个构建","开始": "下一个开始","lint": "下一个lint"},"依赖性":{"antd": "^5.17.0","下一个": "14.2.3","反应": "^18","react-dom": "^18"},"devDependencies": {"@types/node": "^20","@types/react": "^18","@types/react-dom": "^18","eslint": "^8","eslint-config-next": "14.2.3","postcss": "^8","tailwindcss": "^3.4.1","typescript": "^5"}}
pages/index.tsx文件 从“react”导入React;从'antd'导入{按钮};从'@/styles/page.module.css'导入样式const 页面:React.FC = () => {返回(<div key="root" className={styles.root}><p>助开发者「更 轻松」地 stact~</p><文章><h1>So # 组件库</h1></文章><Button type={"primary"}>开始编码</Button></div>)};导出默认页面
报错图片:
The text was updated successfully, but these errors were encountered: