Realm-js: Compiling Realm on electron yields 200+MB realm-js resources directory

Created on 10 Jan 2019  路  9Comments  路  Source: realm/realm-js

I'm using electron-builder to build a desktop app written in React, one of my dependencies uses realm-js. It builds fine, but the Realm folder in my packaged app's Resources folder is 240MB, pushing my app to a hefty size of 500MB.

Version of Realm and Tooling

  • Realm JS SDK Version: 2.19
  • Node or React Native: Node.js
  • Client OS & Version: Mac OS - 10.14.1
O-Community T-Help

Most helpful comment

This might help in the meantime: https://github.com/iotaledger/trinity-wallet/blob/cb5f1df5201a0e1735d06cc229daa85c2533a346/src/desktop/package.json#L81-L86

With these settings, the Mac version of our app turns out to be 223.5MB.

I don't see anything related to Realm in the Resources folder either:

$ ls /Applications/Trinity.app/Contents/Resources
Trinity.icns    electron.asar   hi.lproj    ms.lproj    sw.lproj
am.lproj    en.lproj    hr.lproj    nb.lproj    ta.lproj
app-update.yml  en_GB.lproj hu.lproj    nl.lproj    te.lproj
app.asar    es.lproj    id.lproj    pl.lproj    th.lproj
ar.lproj    es_419.lproj    it.lproj    pt_BR.lproj tr.lproj
bg.lproj    et.lproj    ja.lproj    pt_PT.lproj uk.lproj
bn.lproj    fa.lproj    kn.lproj    ro.lproj    vi.lproj
ca.lproj    fi.lproj    ko.lproj    ru.lproj    zh_CN.lproj
cs.lproj    fil.lproj   lt.lproj    sk.lproj    zh_TW.lproj
da.lproj    fr.lproj    lv.lproj    sl.lproj
de.lproj    gu.lproj    ml.lproj    sr.lproj
el.lproj    he.lproj    mr.lproj    sv.lproj

All 9 comments

@connormakh Did you try to figure out why? And what the content is?

Inside my Resources folder,
realm > vendor > realm-mac-x64 > osx
There are a bunch of .a files:

librealm.a -- 5.8mb
librealm-sync.a -- 2.6mb
librealm-sync-dbg.a -- 59.2mb
librealm-server.a -- 2.3mb
librealm-server-dbg.a -- 60mb
librealm-parser-dbg.a -- 25mb
librealm-parser.a -- 2.9mb

The above seem to be the issue. Is it normal for the file size to be this big?

I wonder why there are debug versions of the binaries and why there is librealm-server.

Not so sure, correct me if I'm wrong, but i think its unnecessary in a production environment for these files to exist

Right, this was more of a question for our JavaScript team 馃槄 We need to figure it out and fix it.

While checking my node_modules, realm folder size is almost 1.09GB. Thats really huge.
I am using it in react-native project and installed it using npm.
Was wondering why such a huge size.
Can we reduce this size?

screenshot 2019-02-01 at 11 53 45 am

This might help in the meantime: https://github.com/iotaledger/trinity-wallet/blob/cb5f1df5201a0e1735d06cc229daa85c2533a346/src/desktop/package.json#L81-L86

With these settings, the Mac version of our app turns out to be 223.5MB.

I don't see anything related to Realm in the Resources folder either:

$ ls /Applications/Trinity.app/Contents/Resources
Trinity.icns    electron.asar   hi.lproj    ms.lproj    sw.lproj
am.lproj    en.lproj    hr.lproj    nb.lproj    ta.lproj
app-update.yml  en_GB.lproj hu.lproj    nl.lproj    te.lproj
app.asar    es.lproj    id.lproj    pl.lproj    th.lproj
ar.lproj    es_419.lproj    it.lproj    pt_BR.lproj tr.lproj
bg.lproj    et.lproj    ja.lproj    pt_PT.lproj uk.lproj
bn.lproj    fa.lproj    kn.lproj    ro.lproj    vi.lproj
ca.lproj    fi.lproj    ko.lproj    ru.lproj    zh_CN.lproj
cs.lproj    fil.lproj   lt.lproj    sk.lproj    zh_TW.lproj
da.lproj    fr.lproj    lv.lproj    sl.lproj
de.lproj    gu.lproj    ml.lproj    sr.lproj
el.lproj    he.lproj    mr.lproj    sv.lproj

@connormakh - how did you compile realm?

@trickyc0d3r i was compiling it via electron-builder

In any case, @rajivshah3's solution is what i ended up going with

Was this page helpful?
0 / 5 - 0 ratings