-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
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
[v2] yarn build crashes out of memory after 92% for huge files #1782
Comments
Any reproducible repo? Hard to reproduce
Sent from Mail for Windows 10
|
Repo to reproduce: https://github.com/leoz/docusaurus_crash |
I have a feel it might be related to a famous "92% chunk asset optimization" issue described e.g. here: angular/angular-cli#5775 |
Hey, @endiliey , anything else I could provide to help investigation? This issue is pretty nasty. I cannot use Docusaurus V2 at all because of that. |
Can you try increasing ur memory limit ? |
"92% chunk asset optimization" is most likely related to webpack - terser plugin. (during uglification/minification) From the log, its out of memory problem |
edit: does not work |
@endiliey , did it actually work for you? |
yep doesnt work. this issue is indeed quite popular for webpack project with large no of files. Quick search on google shows it happened on nuxt, angular, electron, etc and there's no perfect solution im seeing other than increasing the memory allocated i tried to increase memory limit to 16gb and it works "scripts": {
"build": "node --max_old_space_size=16000 node_modules/@docusaurus/core/bin/docusaurus build",
}, |
Well, unfortunately, I cannot confirm it worked. I tried to increase the memory limit for node and it still crashed but later, on "Creating an optimized..." step. I used more docs though. Like 2x number of the docs I've posted on GitHub. |
@leoz can you provide instruction(s) for https://github.com/leoz/docusaurus_crash? i want to investigate the situation |
Hey @evilebottnawi , here you are: git clone https://github.com/leoz/docusaurus_crash.git
cd docusaurus_crash/website/
yarn
yarn build |
thanks, investigate |
@leoz A new version of |
In can pass "Client" configuration (with some hacks), Server █████████████████████████ building (70%) |
try upgrading to alpha.25 and then bump memory limit "scripts": {
"build": "node --max_old_space_size=16000 node_modules/@docusaurus/core/bin/docusaurus build",
}, I think that's the only solution as of now. I cant reproduce the crash anymore now after increasing memory limit. You can also try to tweak node_modules/@docusaurus/core/lib/webpack/base.js and add this line. output: {
futureEmitAssets: true,
} Its an option to tells webpack to use the future version of asset emitting logic, which allows to free memory of Sources with the trade-off of disallowing reading asset content after emitting. This is webpack@5 default way of emitting asset |
However this command worked:
This is, of course, not a solution but rather a workaround. But it solves my problem for now :) |
do you mind trying to use themgoncalves/react-loadable-ssr-addon#18 |
Upon another fresh install & investigation, this shall still crash in alpha.27 although the memory usage is reduced significantly. This is somehow related to clean-webpack-plugin use of webpack Re-opening for now. Possible solution for us: remove clean-webpack-plugin and maybe implement our own 😉 Using plugin to remove build folder can be overkill for simple use case |
This issue is completely gone with Docusaurus v2.0.0-alpha.29. |
@leoz sure thing. Actually had to send two PRs to fix this issue (cos its dependency problem). btw your amount of docs is very huge. 😢 One of the doc is as big as 50kb x.x |
Fix “FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory” described in facebook/docusaurus#1782
🐛 Bug Report
V2:
yarn build
crashes after 92%Have you read the Contributing Guidelines on issues?
yes
To Reproduce
Execute
yarn build
on some nontrivial amount of docs (e.g. 400 md files)Expected behavior
yarn build
does not crash and produces docsActual Behavior
This is an outcome of the failing command
The text was updated successfully, but these errors were encountered: