We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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:无法在模块外使用导入语句
代码: 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"}}
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:
pages/index.tsx代码:
`
import React from "react"; import { Button } from 'antd';
import styles from '@/styles/page.module.css'
const Pages: React.FC = () => { return (
助开发者「更 轻松」地搭建~
export default Pages `
package.json 文件
` { "name": "next-app", "version": "0.1.0", "private": true, "type": "module", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "antd": "^5.17.0", "next": "14.2.3", "react": "^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" } }
Sorry, something went wrong.
提错位置了? 这是 pro-components, 不是 antd
pro-components
antd
No branches or pull requests
问题: 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: