首页 > 解决方案 > 带有 Material UI 的 NextJS 10 编译速度太慢

问题描述

我有一个包含许多组件的项目,但是如果我在保存文件和 NextJS 编译时处理隔离组件,则需要很长时间。我的开发时间受此问题影响。

我运行 4 GB 的 RAM,但它仍然很慢

cross-env NODE_OPTIONS="--max_old_space_size=4096" next

我该如何解决这个问题?

可能的问题是什么?

标签: javascriptreactjsperformancecompilationnext.js

解决方案


如果您使用导入组件

import {List,Grid,ListItem} from '@material-ui/core';

而是尝试使用

import List from '@material-ui/core/List';
import Gridfrom '@material-ui/core/Grid';
import ListItem from '@material-ui/core/ListItem';

这对我有用。


推荐阅读