Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Executing JS file with a "require(..\)" of local modules #203

Open
IvanHolynskyi opened this issue Mar 5, 2021 · 0 comments
Open

Comments

@IvanHolynskyi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant