Skip to content

chore: move project dependencies to reduce build size#262

Open
egalvis27 wants to merge 1 commit intomainfrom
feat/reduce-build-size
Open

chore: move project dependencies to reduce build size#262
egalvis27 wants to merge 1 commit intomainfrom
feat/reduce-build-size

Conversation

@egalvis27
Copy link

What is Changed / Added


♻️ Reorganized Dependencies (runtime vs devDependencies)

Context: After merging the two package.json files into one, the build size increased by almost 50%. This reorganization was necessary to restore the original size by correctly separating runtime from development dependencies.

Reorganized dependencies based on actual runtime requirements by analyzing:

  • Webpack externals configuration
  • Main process imports
  • Native module requirements
  • Backend service dependencies

🔧 Technical Details

Webpack Configuration

// .erb/configs/webpack.config.base.ts
const nativeExternals = [
  '@gcas/fuse',       // Native FUSE bindings
  'better-sqlite3',   // Native SQLite3
  'reflect-metadata', // TypeORM requirement
  'typeorm',          // ORM with runtime reflection
];

These externals are not bundled by webpack, so they must remain as runtime dependencies. All other dependencies used in the main process are either:

  • Bundled by webpack into main.js
  • Provided by Electron's built-in modules
  • Only used during development/testing

Why React/UI libraries moved to devDependencies

  • Webpack bundles the entire renderer process into renderer
  • React and all UI components are compiled and tree-shaken
  • No runtime node_modules access needed for renderer

Backend dependencies kept in dependencies

  • axios — Used by drive-server client and backup services
  • express — Hydration API server runs at runtime
  • diod — Dependency injection used throughout main process
  • async, uuid, form-data, bottleneck, etc. — Used by main process services

🎯 Impact

Before After
Dependencies in .deb 45 18
Reduction in packaged deps ~60%
Reduction in .deb size ~50%
  • ✅ No functional changes — all bundled code remains identical
  • ✅ Electron-builder now packages only essential runtime dependencies
  • ✅ Unnecessary React libraries (~30MB+) no longer included

@sonarqubecloud
Copy link

@egalvis27 egalvis27 requested a review from AlexisMora February 27, 2026 20:49
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.

1 participant