[Question] Executing JS file with a "require(..\)" of local modules
IvanHolynskyi opened this issue · comments
Hi! Need a help. Maybe you may prompt me a proper way how solve my issue.
During Android App running I downloaded zipped "*.js" files from some external storage (f.e. cloud). After unzipping it in APP_DIR (f.e. "/data/data/com.app.name/files") I got some directory structure. For example:
APP_DIR/libs/add.js
APP_DIR/tests/test.js
APP_DIR/many_other_directories_and_files_that_require_relative_paths.js
Then I should run "test.js" in MicroService. But there is 'require()' in a code with a relative paths. For example:
"test.js"
require('../libs/add.js');
console.log('Hey, Jude! ' + addFunc(1, 2))
"add.js"
addFunc = function(a, b) {
return a + b;
}
module.exports = addFunc;
As I understood after reading some closed issues the best way to execute "test.js" that requires local modules is running a single "test_bundle_with_modules.js" file which was previously "bundled" with modules using liquidcore-cli
(or another instrument?). But I have no idea how do that in a runtime. Maybe there is some way to achieve proper executing "test.js"? Thanks in advance.