capacitor-community / capacitor-community/electron
Including the package increases the build size by ~15 MB
- Dominant language
- TypeScript
- Stars
- 398
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Simply adding the package increases the build size by about 15 MB. It seems like the package drags along dev-only packages into production as part of node_modules. This negatively influences both the build size and the startup time.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a new Electron Forge + Vite project with `npm init electron-app@latest my-new-app -- --template=vite-typescript`
2. Run `yarn package`. Observe the `resources` in the build being around 200 KB in size.
3. Run `yarn add @capacitor-community/electron` then `yarn package`. Observe the `resources` in the build being around 15 MB in size.
**Expected behavior**
Since this package is basically a helper to glue Capacitor and Electron together, it shouldn't have any actual influence on the resulting build. Pretty much the only things normally used in runtime from the entire package are two lines:
```js
import type { CapacitorElectronConfig } from '@capacitor-community/electron';
import { getCapacitorElectronConfig, setupElectronDeepLinking } from '@capacitor-community/electron';
```
**Desktop (please complete the following information):**
- OS: Windows 11
- Version 5.0.1
**Additional context**
Same happens when an Electron project is created with `npx cap add @capacitor-community/electron`.
Contributor guide
Research direction
Reproduce the size difference with the Electron Forge + Vite TypeScript project using the listed npm and yarn commands. Inspect the package's production dependency metadata and compare the packaged resources before and after installation. Done means dev-only packages are excluded from production and the packaged resources remain near the original size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- build-system, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100