yarn add webpack produces javascript heap out of memory

Created on 7 Oct 2018  路  1Comment  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

Bug
What is the current behavior?
yarn produces javascript heap out of memory issue when upgrading to [email protected] particularly. I have not found it to be an issue when upgrading other packages.

further investigation shows that anything beyond 4.5.0 have this out of memory issue. I was able to successfully install [email protected]

screen shot 2018-10-06 at 5 57 07 pm

If the current behavior is a bug, please provide the steps to reproduce.

git clone https://github.com/fobbyal/yarn-install-mem-heap-issue.git
yarn install
yarn add [email protected]

What is the expected behavior?
yarn installs the [email protected] succssfully.

Please mention your node.js, yarn and operating system version.
[email protected] [email protected] on OSX and [email protected] on arch linux

help wanted

Most helpful comment

I started trying to debug into this. Nothing conclusive yet, but just adding some research notes...

Something is going wrong during the hoisting process. yarn is somehow getting into a loop between schema-utils and uglifyjs-webpack-plugin somehow trying to place them like 180-some directories deep nested in each other.

It's weird... I originally thought there might be a cyclical dependency, but there isn't.

Here is a couple iterations of the HoistManifest that it's building:

image

You can see the repeated package names above, but it does somehow break out to webpack after a while, but will later go back to cycling between combinations of these 2 or 3 packages.

Debugging this is a real pain because any time you step too far, you have to kill the process and start over. But... trying to figure it out...


_additional notes:_

Something seems to be up with uglify-webpack-plugin. I think it keeps trying to hoist it over.

PackageHoister.seed() keeps calling PackageHoister.hoist() passing uglifyjs-webpack-plugin over and over. Each call appends it to HoistManifest.partsand so it keeps pushing that package deeper and deeper into a nonexistent path.

>All comments

I started trying to debug into this. Nothing conclusive yet, but just adding some research notes...

Something is going wrong during the hoisting process. yarn is somehow getting into a loop between schema-utils and uglifyjs-webpack-plugin somehow trying to place them like 180-some directories deep nested in each other.

It's weird... I originally thought there might be a cyclical dependency, but there isn't.

Here is a couple iterations of the HoistManifest that it's building:

image

You can see the repeated package names above, but it does somehow break out to webpack after a while, but will later go back to cycling between combinations of these 2 or 3 packages.

Debugging this is a real pain because any time you step too far, you have to kill the process and start over. But... trying to figure it out...


_additional notes:_

Something seems to be up with uglify-webpack-plugin. I think it keeps trying to hoist it over.

PackageHoister.seed() keeps calling PackageHoister.hoist() passing uglifyjs-webpack-plugin over and over. Each call appends it to HoistManifest.partsand so it keeps pushing that package deeper and deeper into a nonexistent path.

Was this page helpful?
0 / 5 - 0 ratings