Next.js 13.5集成Material Tailwind构建时栈溢出错误如何解决?
Next.js 13.5 + Material Tailwind 构建报错问题
问题现象
我创建了最新版Next.js 13.5项目,安装Material Tailwind后,开发模式下使用其Button组件运行完全正常,但执行yarn build或部署到Vercel时出现错误;移除Material Tailwind组件后,开发、构建和部署均正常,再次导入组件则仅开发模式正常,构建时报错。
错误信息
yarn run v1.22.19 $ next build ✓ Creating an optimized production build ✓ Compiled successfully ✓ Linting and checking validity of types ✓ Collecting page data Generating static pages (4/5) [== ] RangeError: Maximum call stack size exceeded at P (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:66159) at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:61350) at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62551 at Array.forEach (<anonymous>) at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62524 at Array.forEach (<anonymous>) at a (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62344) at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62608 at Array.forEach (<anonymous>) at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62301) Error occurred prerendering page "/" RangeError: Maximum call stack size exceeded at P (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:66159) at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:61350) at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62551 at Array.forEach (<anonymous>) at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62524 at Array.forEach (<anonymous>) at a (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62344) at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62608 at Array.forEach (<anonymous>) at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/c ✓ Generating static pages (5/5) > Export encountered errors on following paths: /page: / error Command failed with exit code 1.
测试代码(page.js)
"use client"; import { Button } from "@material-tailwind/react"; const Home = () => { return ( <main> <Button>Click me</Button> </main> ); }; export default Home;
内容的提问来源于stack exchange,提问作者Jaznan Abdullah
相关产品推荐
相关产品推荐

