Webpack,Sass - 超出最大调用堆栈大小 [英] Webpack, Sass - Maximum call stack size exceeded

查看:97
本文介绍了Webpack,Sass - 超出最大调用堆栈大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Webpack 用于我的 JS 应用程序.对于我使用 Sass 的样式.我的应用程序很大,所以我使用了很多 @mixins 和 @includes.

I'm using Webpack for my JS application. For the styles I'm using Sass. My application is pretty big, so I'm using a lot of @mixins and @includes.

在过去几天(虽然应用程序的 SASS 数据增长了一点),我多次遇到以下相同的错误:未捕获的 RangeError:超出最大调用堆栈大小".

In the last couple of days (while the app's SASS-data grew a bit more) I faced the same following error multiple times: "Uncaught RangeError: Maximum call stack size exceeded".

你们之前有没有人也遇到过 Sass 的问题?这个错误通常是如何发生的?

Did anyone of you have this issue with Sass before, too? How does this error occur there usually?

好的,我发现,递归不是问题所在.它适用于 Mac 的 Firefox 和大多数 Windows 浏览器,但不适用于 Mac 的 Chrome 和 Safari,因为它们的调用堆栈大小限制要低得多.

Okay, I found out, that recursiveness is not the problem. It works in Mac's Firefox and most of the browsers for Windows, but not for Mac's Chrome and Safari, because their call stack size limit is way lower.

有没有一种有效的方法可以轻松达到浏览器的调用堆栈大小?我读过 webpack 的 Uglify,但这只会减少我的应用程序的大小,而不是调用量,对吧?

Is there an efficient way to pretend to reach the browser's call stack size that easy? I read about webpack's Uglify, but that does just reduce my app's size, not the amount of calls, right?

还有其他想法吗?

推荐答案

我最近遇到了同样的问题并遇到了这个线程,但我的问题是在 Webpack 和 Uglify 中使用 React App Build捆绑错误.节点构建命令中的以下更改解决了我的问题.

I've faced this same problem recently and came across to this thread but my problem was with React App Build in Webpack and Uglify bundle error. Below changes in the node build command solved my issues.

node --stack-size=<your-size> scripts/build.js

示例

node --stack-size=1000 scripts/build.js

为什么 max-old-space-size 中的 size 是 1000?

基本上,它取决于您当前应用程序脚本的调用堆栈.

Why size is 1000 in max-old-space-size?

Basically, it varies depends on the call stack of your current application scripts.

这基本上停留在我们的引擎 v8 中.以下命令可帮助您了解本地节点 v8 引擎的调用堆栈大小.

This is basically stay in our engine v8. below command helps you to understand the Call stack Size of your local node v8 engine.

node --v8-options | grep -B0 -A1 stack-size

这篇关于Webpack,Sass - 超出最大调用堆栈大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆