【问题标题】:NextJS 10 with Material UI compiling too slow带有 Material UI 的 NextJS 10 编译速度太慢
【发布时间】:2021-03-17 09:46:38
【问题描述】:

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

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

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

我该如何解决这个问题?

可能的问题是什么?

【问题讨论】:

  • 您知道具体是什么导致编译时间过长吗?您的构建尺寸是什么样的?
  • 我有很多组件,可能是因为这个?

标签: javascript reactjs performance compilation next.js


【解决方案1】:

如果您使用导入组件

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';

这对我有用。

【讨论】:

  • 谢谢,我会试试这个方法!
猜你喜欢
  • 2018-07-03
  • 2021-07-21
  • 2021-04-04
  • 2016-01-16
  • 2014-08-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多