Skip to content

refactor: more size reduction#1396

Merged
fadi-george merged 4 commits intomainfrom
fg/reduce-size-2
Oct 6, 2025
Merged

refactor: more size reduction#1396
fadi-george merged 4 commits intomainfrom
fg/reduce-size-2

Conversation

@fadi-george
Copy link
Copy Markdown
Contributor

@fadi-george fadi-george commented Oct 3, 2025

Description

1 Line Summary

More size reduction via _ prefix.

Details

  • Update non api.json spec class properties to have an underscore prefix. This to allow vite to mangle the properties name to smaller strings to reduce bundle size.
// Old
  build/releases/OneSignalSDK.page.js
  Package size is 1 B less than limit
  Size limit: 421 B
  Size:       420 B gzipped
  
  build/releases/OneSignalSDK.page.es6.js
  Size limit: 50.29 kB
  Size:       50.29 kB gzipped
  
  build/releases/OneSignalSDK.sw.js
  Size limit: 13.62 kB
  Size:       13.62 kB gzipped
  
  build/releases/OneSignalSDK.page.styles.css
  Size limit: 8.81 kB
  Size:       8.8 kB  gzipped
  
// New
  build/releases/OneSignalSDK.page.js
  Package size is 1 B less than limit
  Size limit: 421 B
  Size:       420 B gzipped
  
  build/releases/OneSignalSDK.page.es6.js
  Size limit: 49.63 kB
  Size:       49.63 kB gzipped
  
  build/releases/OneSignalSDK.sw.js
  Size limit: 13.62 kB
  Size:       13.62 kB gzipped
  
  build/releases/OneSignalSDK.page.styles.css
  Size limit: 8.81 kB
  Size:       8.8 kB  gzipped
  

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

Checklist

  • All the automated tests pass or I explained why that is not possible
  • I have personally tested this on my machine or explained why that is not possible
  • I have included test coverage for these changes or explained why they are not needed

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed

Related Tickets



This change is Reviewable

Copy link
Copy Markdown
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good.

Did this change only effect the size of OneSignalSDK.page.es6.js this time?, I only see this size updated in package.json.

@fadi-george
Copy link
Copy Markdown
Contributor Author

Code changes look good.

Did this change only effect the size of OneSignalSDK.page.es6.js this time?, I only see this size updated in package.json.

Yeah 50.29 -> 49.63

@fadi-george fadi-george merged commit f501b6e into main Oct 6, 2025
3 checks passed
@fadi-george fadi-george deleted the fg/reduce-size-2 branch October 6, 2025 18:28
@github-actions github-actions Bot mentioned this pull request Feb 27, 2026
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

Successfully merging this pull request may close these issues.

2 participants