eclipsesource / eclipsesource/J2V8

File structure & build approach for larger NodeJS projects

Open
#300 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.6k
Forks
387
PR merge metrics
No merged PRs in 30d

Description

Hi,

What would be the best way to go about running larger projects with J2V8? I have a project with a ±50 internal modules and same amount of dependencies. All the documents point to creating a temp file and then executing that file. I'm testing on J2V8 ARM arch, using the docker build on Mac. Simple scripts are working beautifully.

I've tried 2 approaches so far for a larger project and would like to find out which approach to focus on to get my application running using J2V8.

### 1st approach - bundling into 1 file
I have tried using Webpack to bundle the whole project into one file and then package the bundle file as an Asset. Issue so far is getting the bundled file to execute even on normal Node side so it's more a Webpack issue, but I'm wondering if it's worth going through the effort if there is another solution.

### 2nd approach - packaging entire project as APK Assets
I included the entire NodeJS project as an Assets directory in the APK and use only the application entry script to start the node instance using J2V8. The issue here is finding all the required modules from the execution path in Android (using the temp file), I couldn't yet set up my include path correctly.

If the 2nd approach has a chance of working I would prefer it, but any solution will help!

What would be the best approach for the application to work in this case?

Regards,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.