-
Notifications
You must be signed in to change notification settings - Fork 65
Unable to build project with 3box - vue-cli - Allocation failed - JavaScript heap out of memory #408
Comments
I could run with the following, to increase node memory limit
but something not playing nice still with the default webpack plugins used in vue, the memory footprint should not be that much and other webpack builds are not hitting the node limit. The size of the lib is likely not the cause, its due to some other process running, could be transpiling or linting or other pre processors, can't say for sure at moment. This temp fix may also be slow to build. Also looks like the production configs end up with a much bigger build than when we build it with webpack |
Ye this seems to fix it, thanks guys |
@zachferland @oed I'm running into the same problem. This likely due to main pointing to the When a client application is running a bundling process (like webpack), it reads those require statements and attempts to bundle them too, using a huge amount of memory. Additionally, import Box from '3box' will be using a lot of memory to bundle 3box. I'm not sure what the best solution is. At first I thought one easy solution is to change the entry to point to the |
Thanks for the recommendations @Schwartz10! In addition to solving this long term with one of the solutions you proposed, we also have a short term solve for this sprint to document (in the readme or elsewhere perhaps) how to overcome this issue by increasing the memory allocation for the build process. |
Ok great @michaelsena thank you! Also, not sure if you saw but i edited some of my original post after doing some testing with an idea i initially thought would work. Unfortunately adding to the memory allocation isn't solving the problem for me because 3box code is getting bundled inside an app that already uses a ton of memory to bundle. I'm wondering, is there another way around this? Why not compile |
thanks the followup @Schwartz10! The I would be more concerned if we export the dist by default (that is mostly just for people to fetch from CDN if they want, or in worst case can't build it themselves), since all the above would be lost. But yeah ipfs is large, and could alone be contributing to it. It also a combined with the effect of what other tooling, parser, preprocessors etc, you have in your build. For example we can build it without hitting any limits with the webpack config in this repo. Do you just have a webpack build? can you bundle/build just Orbitdb or ipfs in it? But could be possible the es5 output, or if anything else in there, could be giving it trouble to. You could also try build from importing/requiring the src folder and see if that works. Im still interested to figure out exactly what it is. Surprised the memory option didn't work, although not great may be able to increase further even. |
Ah i see. Makes a lot of sense.
This is a good idea. I spent the majority of the day yesterday figuring out what was causing the memory issue (a friend found this issue after we had figured out what was causing it lol). So I'll have another crack at it today/tomorrow and see if I can figure out how to make things work. |
Joining the conversation as we are having similar issues. Right now we could work around the bundle issue with the light-weight version you guys put together, but since we are looking to use the Threads API soon enough, I'm sure that won't be a viable solution anymore. My team will poke at some ideas and workarounds, in the meantime, I'll be in the Discord channel (tag:jjperezaguinaga) in case you have any suggestions. Thanks! |
Thanks for chiming in @jjperezaguinaga! Happy to hear any ideas your team has 🙂 The new version with updated threads is being released tomorrow and will be a significant reduction in size. Hopefully that will mitigate this issue for most people. |
@jjperezaguinaga That's definitely a great idea :) We actually explored it as well and for a short period of time 3box-js shipped without ipfs and instead used ipfs though an iframe as you describe. Unfortunately we had to roll that back because we where getting strange bugs. The good thing about it is that data can be shared between dapps so every dapp doesn't need to sync data from scratch. It turned out that the bugs where not because of that we had ipfs within the iframe, but because we had the orbitdb cache (where the latest heads of DBs are stored) also in the iframe and we had a bug in that code. We have a fix for this now so it's definitely something to get back to soon! Another thing to consider is security. We don't want any random dapp to start messing around with the data in the iframe such that it breaks the users data store. |
@oed @zachferland just bundled using only babel and no bundling software (webpack, rollup..etc). However when I try to link to this pacakge locally i get:
I went into the Also as a side node, when i
|
Oh! Sounds like a problem with the npm release from orbit-db. Maybe they accidentally added .git to their package? I'll ping them and ask! |
Think that's definitely the issue. Please keep me updated on this! |
Hey @Schwartz10 @oed thanks for the heads up! Just published an orbit-db patch without the .git dir. Does this fix the issue? |
worked for me: |
Describe the bug
When building a project with 3Box in via vue-cli - I receive a
Allocation failed - JavaScript heap out of memory
To Reproduce
Steps to reproduce the behavior:
vue-cli
vue create
and create a simple project3box
npm run build
Expected behavior
Project builds as normal
Desktop (please complete the following information):
v8.9.4
6.9.0
3.7.0
Additional context
Console output below:
I have also tried bumping memory opts to 4gb
The text was updated successfully, but these errors were encountered: