Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49361

Distribute a dictionary (a json file ~15M or ~5M zipped) as a part of an app

$
0
0

I am working on an app that will display user-provided text. I want to be able to provide user with a translation of specific words they select in the text, using a dictionary.

A dictionary is a json file, about 15MB unzipped, about 5MB zipped.

I would like to ship the app with dictionary packaged in, so that users wouldn’t have to download anything.

I considered several options:

  • just import json file in the code (import dictJson from "./dict.json";). This makes the “ionic build” to go OOM (even after giving node 8Gb of RAM)
  • put the json file into an asset folder and load it from there at runtime

I have no idea if asset folder is supposed to be used like this. I have no idea how to read from asset folder. The documentation of Ionic does not provide much help on this subject.

I see some suggestions online to use http.get to access the asset, and other people replying it’s no longer supported, but I found nothing trustworthy enough to be quoted here.

I would like to know what is the standard, supported way to package a static resource with an app and load it at runtime, and what is the size limit for such a static resource. Thank you

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 49361

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>