Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor build script fixes #2516

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Nov 1, 2024

  1. fix: enable override when reading .env file

    Changes in `.env.development.local` should override those in `.env`, but this was not working as intended.
    Faiz Mustafa committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    ab97bbb View commit details
    Browse the repository at this point in the history
  2. fix: Capacitor build scripts improperly configured

    Prior to this fix, `yarn cap:android`  built a static development version of the app. It builds correctly, but upon opening the app the user just gets a black screen.
    
    This was happening because of a line in the Capacitor config file that says to use a development server defined in `.env` instead of loading from local built assets (if `NODE_ENV=development`)
    
    So there was an incongruency – `cap:android` is creating a static build, but the Capacitor config is set up to use live server.
    
    I have resolved this with some changes in `capacitor.config.ts` and some new scripts in `package.json`:
    
    * yarn cap:android:dev – dev build that uses live server
    * yarn cap:android:static – dev build that uses static assets
    * yarn cap:android – dev build that uses live server (default)
    
    and the same for yarn cap:ios, yarn cap:ios:static, yarn cap:ios:dev.
    
    Now all build scripts work as intended.
    Faiz Mustafa committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    be18c36 View commit details
    Browse the repository at this point in the history
  3. upd: set default CAPACITOR_SERVER_URL

    Set CAPACITOR_SERVER_URL to the default address the dev server runs at (localhost:3000), and guide users to change in .env.development.local if necessary.
    
    This enables usage of the dev server directly after cloning without any config.
    Faiz Mustafa committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    5e0ccd8 View commit details
    Browse the repository at this point in the history