NativeScript / NativeScript/android

[FR] Customize metadata generation to avoid adding unnecessary unused JS wrappers

Open
#1,485 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature optimization
Dominant language
C++
Stars
563
Forks
144
Avg merge
10h 46m
Merged PRs (30d)
14

Description

Is your feature request related to a problem? Please describe.
Currently, the whole Android SDK and all native libraries used in a {N} app are included in the metadata binary files. In order to reduce app size and improve startup performance, we should allow app/plugin developers to specify which entities (e.g. Java packages) need to actually be accessible from JavaScript.

Additional context
Things to consider:

  • This will be a breaking change because every plugin and every app which directly call into native code will need to start stating their native dependencies
  • Multiple such dependency lists coming from all plugins and the app should be merged. Maybe some changes in the CLI will be necessary as well.
  • There should be a way to allow everything to be included (like it's been before this feature)

An idea for UI which helps generate these lists from @shirakaba: Polyfill.io shows one user interface by which one could generate a package by specifying only the libraries that one needs. Maybe something like this could be applied to the NativeScript runtimes: https://polyfill.io/v3/url-builder/

Corresponding feature request in iOS runtime is: https://github.com/NativeScript/ios-runtime/issues/1209

Implemented in {N} CLI with: https://github.com/NativeScript/nativescript-cli/issues/5220

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No Android files, tests, or entry points are named. Start with the linked NativeScript CLI issue #5220 and the corresponding iOS runtime issue #1209, then determine how Android metadata generation should consume merged app and plugin dependency lists; done should include an opt-in way to limit exposed entities and a way to preserve the existing include-everything behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
build-system, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.