nativescript-cli icon indicating copy to clipboard operation
nativescript-cli copied to clipboard

feat: build flag to append generated suffix to bundles

Open jcassidyav opened this issue 1 year ago • 0 comments

PR Checklist

  • [X] The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages.
  • [ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
  • [X] You have signed the CLA.
  • [X] All existing tests are passing: https://github.com/NativeScript/nativescript-cli/blob/master/CONTRIBUTING.md#contribute-to-the-code-base
  • [ ] Tests for the changes are included.

What is the current behavior?

See discussion: https://discord.com/channels/603595811204366337/1276116878154268763

It seems to be the case that sometimes when an iOS app is updating it does not overwrite the old js files with the new versions, resulting in app crashes etc.

What is the new behaviour?

This adds a new flag --unique-bundle which instructs the cli to generate an id, which is then passed to webpack to be appended as a suffix to generated bundle names.

The cli then uses this id to set the main entry in the package.json in the resulting app.

Note: In the discussion linked to above the files are generated with hashes, but then it becomes complicated to find the correct name of the main entry and I believe more brittle. An option would be to use something like the webpack-manifest-plugin to find the hashed value, or just assume a pattern but this seems a more straightforward solution.

There is a corresponding @nativescript/webpack PR #10614

jcassidyav avatar Aug 28 '24 13:08 jcassidyav