output "Last few GCs,JavaScript heap out of heap" when build 20 thousands pages #19082
Replies: 1 comment
-
Please use profiling - https://webpack.js.org/plugins/profiling-plugin/, there are many places where this problem can occur, and it is very difficult to answer the question where exactly it happens without a configuration or a reproducible example The steps you tried to apply to fix it is the correct approaches to find the problem, it would be really nice to see the configuration. Also try using the latest version - https://github.com/webpack/webpack/releases I have moved it to discussions for now, but this does not mean that we do not want to help solve the problems, it is just that without additional information it is not solvable at the moment. Does this only happen in development or production mode or both? Are there any successful builds or does this happen all the time? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
build machine: linux 8core 32G memory
vue-cli project
Project npm package:
vue3: 3.2.37
webpack: 5.89.0
@vue/cli-service: 5.0.8
vue-loader:17.4.2
node: 16.10.0
In our project,we have twenty thousands vue pages and five thousands js modules.These pages is dynamic imported to the with :is attribute,that is dynamic component in vue,and we build these pages to independent async chunks in webpack.But now, the project was build failed due to "JavaScript heap out of heap".we have adopt some solutions,such as,
(1) add the node memory to 16G/24G through "cross-env NODE_OPTIONS=--max-old-space-size=16384";
(2)upgrade node version to 20 and reinstall relevant package;
(3)using webpack build instead of using vue-cli-service build,in order to avoiding extra plugins to slowing the build;
(4)use the cache.cacheDirectory options in webpack5;
(5)use DLLPlugin and DLLReferencePlugin to build the node_modules and other common components
but the above solutions were all failed with the same reason.
Unbelievable,when we decrease the pages number to about ten thousands,it can build success.
In addition,our project was upgraded from vue2,in vue2,it was build success with the same scale pages and js in webpack5.
Anyone else has the webpack build experence with the huge pages,how should I do to solve this problem? thanks!
Beta Was this translation helpful? Give feedback.
All reactions