@cond/cra-append-sw
Utility tool to append custom code to ServiceWorker created by Create React App
Last updated 21 days ago by cond .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cond/cra-append-sw -g
SYNC missed versions from official npm registry.

cra-append-sw

Utility tool to append custom code to ServiceWorker created by Create React App.

It allows to keep the default CRA configuration (no ejecting). It simply appends custom code to the ServiceWorker file created by CRA build scripts. By default, it bundles the code using very basic Webpack+Babel configuration (this can be omitted; see options).

Installation

$ npm install cra-append-sw --save

Usage

$ cra-append-sw [options] <file>

Options

-s, --skip-compile      Skip compilation
-h, --help              Output usage information
-e, --env [path]        (./.env) Path to environment variables file
-m, --mode [mode]       Output mode

Output modes

  • dev creates public/<file> instead of appending the code to build/service-worker.js
  • build creates build/<file> instead of appending the code to build/service-worker.js
  • replace simply replaces build/service-worker.js

Usage with Create React App

In package.json modify build script to:

"start": "react-scripts start && cra-append-sw --mode dev ./custom-sw.js",
"build": "react-scripts build && cra-append-sw ./custom-sw.js",

Current Tags

  • 1.0.1                                ...           latest (21 days ago)

2 Versions

  • 1.0.1                                ...           21 days ago
  • 1.0.0                                ...           21 days ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 20
Last Day 0
Last Week 2
Last Month 0
Dependencies (11)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |