I have an express script (index.js( in which I load a bunch of api function from other js files. In one file (text.js) I am exporting a function that tokenizes text that requires the following:
const tokenize = require('chinese-tokenizer').loadFile('./cedict_ts.u8');
The cedict file is ~10MB.
The question is, when I deploy to firebase and index.js api functions are loaded, is the 10MB file preloaded into memory or is that when an api call occurs then the 10MB file is loaded? Also, if an api call happens that does require a function from text.js, would the 10MB still load into memory?
Basically, I want to figure out if it would be better to put the require call inside the function that tokenizes and not on top of text.js.