npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@proj-airi/cap-vite

v0.9.0-alpha.28

Published

CLI that starts a Vite dev server and runs Capacitor live reload

Readme

@proj-airi/cap-vite

CLI for Capacitor live-reload development using Vite.

Usage

cap-vite [vite args...] -- <ios|android> [cap run args...]

Examples:

pnpm exec cap-vite -- ios --target <DEVICE_ID_OR_SIMULATOR_NAME>
pnpm exec cap-vite -- --host 0.0.0.0 --port 5173 -- android --target <DEVICE_ID_OR_SIMULATOR_NAME> --flavor release
CAPACITOR_DEVICE_ID_IOS=<DEVICE_ID_OR_SIMULATOR_NAME> pnpm exec cap-vite -- ios
pnpm -F @proj-airi/stage-pocket run dev:ios -- --target <DEVICE_ID_OR_SIMULATOR_NAME>
  • Arguments before -- are forwarded to vite.
  • Arguments after -- are forwarded to cap run.
  • If the platform-specific env is set (CAPACITOR_DEVICE_ID_IOS or CAPACITOR_DEVICE_ID_ANDROID) and cap run args do not contain --target, cap-vite injects --target with that value automatically.
  • cap-vite always launches the Vite dev server. Do not pass vite dev or vite serve as extra args.
  • After the dev server starts, press R in the terminal to re-run cap run without restarting Vite.

You can see the list of available devices and simulators by running pnpm exec cap run ios --list or pnpm exec cap run android --list.

Capacitor Configuration

You need to set server.url in capacitor.config.ts to the env variable CAPACITOR_DEV_SERVER_URL, then the cli will handle rest for you.

const serverURL = env.CAPACITOR_DEV_SERVER_URL
const isCleartext = serverURL?.startsWith('http://') ?? false

const config: CapacitorConfig = {
  appId: 'com.example.app',
  appName: 'Example App',
  webDir: 'dist',
  server: serverURL
    ? {
        url: serverURL,
        cleartext: isCleartext,
      }
    : undefined,
}

export default config

Why we need this?

  • No need to care what server.url should be, it will be automatically set to the correct value.
  • Rerun native app when native code changes, you won't forget to start it.
  • Rerun cap run on demand from the same terminal when you need a clean native relaunch.
  • No need to open two terminals to run the project, you can run it with one command.

Architecture Notes

  • Vite arguments are left to the real Vite CLI instead of being reimplemented inside cap-vite.
  • cap-vite injects a wrapper config so it can append its own Vite plugin without editing the user's existing vite.config.*.
  • The injected plugin reads server.resolvedUrls, starts cap run, and restarts it when files under the native platform directory change or when you press R in the terminal.
  • cap-vite only splits the two argument groups and passes the cap run arguments into the injected plugin through environment variables.