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

cordova_script

v1.2.0

Published

package for reco cli (react.cordova)

Readme

cordova_script

Injects the right cordova.js <script> tag for the way your app is currently running. It is an internal helper for the reco CLI (react.cordova).

You probably don't want to install this directly. reco init already adds it to new projects and wires up the import. There is no API, no exports, and no configuration — installing it by hand only makes sense if you are assembling a React + Cordova project without reco.

What it actually does

Importing the package registers a load listener that appends a <script> tag pointing at cordova.js. The only thing it decides is the URL:

| Condition | cordova.js resolved from | | --- | --- | | NODE_ENV === "production" | <PUBLIC_URL>/cordova.js — the copy Cordova itself injects into the packaged app | | Anything else | http://<host>:8597/browser/www<PUBLIC_URL>/cordova.js — served by cordova serve 8597, which reco start runs for you |

Changed in 1.2.0. The production path used to also require "serviceWorker" in navigator, copied from Create React App's service-worker boilerplate even though this package registers no service worker. But navigator.serviceWorker is undefined on file:// and on WKWebView custom-scheme origins — exactly the packaged-app environments this shim exists for — so those builds silently fell through to the localhost dev URL and Cordova never loaded. A production build now always takes the production path.

That is the whole package: about thirty lines, no dependencies, no exports. It also appends an HTML comment to the document body so you can see where the tag came from when reading the DOM.

Usage

Import it once, for its side effect, before you mount your app — then wait for Cordova's deviceready event:

import ReactDOM from "react-dom/client";
import App from "./App";
import "cordova_script"; // side-effect import: injects cordova.js

document.addEventListener(
  "deviceready",
  () => {
    ReactDOM.createRoot(document.getElementById("root")).render(<App />);
  },
  false
);

This is exactly what the reco project template generates.

Install

npm install cordova_script

Expects a bundler that substitutes process.env.NODE_ENV and process.env.PUBLIC_URL (Create React App, Webpack, and similar). Port 8597 is hard-coded to match the dev server reco starts.

License

ISC © ui-db.com