GithubHelp home page GithubHelp logo

workbox-cdn's Introduction

Workbox Unofficial CDN

automated circle ci npm version npm downloads install size

Workbox unofficial CDN and standalone NPM package.

Important

This redist is not maintained and uses older v5 version of workbox CDN.

Why?

  • Having public usage/download stats
  • The local type costs ~8M install size for workbox-cli package vs < 1Mb of this package
  • Default workbox CDN is hosted on storage.googleapis.com which was restricted on some regions

Usage

Add a call to workbox.setConfig({modulePathPrefix: '...'}) to your service worker to use hosted workbox libraries. See Using Local Workbox Files Instead of CDN for further documentation.

You have two options:

Option 1: JSDelivr

Use https://cdn.jsdelivr.net/npm/workbox-cdn@5/workbox/workbox-sw.js:

workbox.setConfig({
  modulePathPrefix:
    "https://cdn.jsdelivr.net/npm/workbox-cdn@5/workbox/workbox-sw.js",
});

Option 2: NPM Package

Install workbox-cdn package with yarn add workbox-cdn or npm i workbox-cdn and integrate it with your own build system or serve contents of workbox dir.

License

Copyright 2018 Google LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

workbox-cdn's People

Contributors

clarkdo avatar dependabot[bot] avatar nozomuikuta avatar pi0 avatar renovate[bot] avatar sukkaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

workbox-cdn's Issues

Alpha version of workbox 5.0.0 has released

Since workbox 5.0.0 alpha 1 and workbox alpha 2 is released, we should bump package.json to v5.0.0-alpha.0, then v5.0.0-alpha.1 , then v5.0.0-alpha.2 to get update with it.

I am thinking about list published version from npm everyday & drop a new version for workbox-cdn if workbox has released a new version.

Alpha & Beta version of workbox has released

Google has released 4.0.0-alpha.0and4.0.0-beta.0` of workbox lib.
Should we make update?

Also, I think it is better to let CI check the version and automatically publish new version when one existed.

How could i load package locally ?

Hello, i am using nuxt2.10 and @nuxtjs/pwa": "3.0.0-beta.19",
also i add this package to stop importing script from cdn jsdeliver.
this is my workbox config:

  workbox: {
    config: {
      modulePathPrefix: '/node_modules/workbox-cdn/workbox/workbox-sw.js',
    },
  },

the problem is when i build the project
the generated sw.js will look like this:

importScripts('https://cdn.jsdelivr.net/npm/[email protected]/workbox/workbox-sw.js')

// --------------------------------------------------
// Configure
// --------------------------------------------------

// Set workbox config
workbox.setConfig({
  "modulePathPrefix": "/node_modules/workbox-cdn/workbox/workbox-sw.js",
  "debug": false
})

still i have the importscript from cdn,
how can i change or remove it?
and also i have these error on my console and network tab.
2
1

Thank you in Advance.

How can i use the package

Hello! Could you provide some example to how use the option 2? I read the workbox documentation for Nuxt PWA and seems i have to use workboxURL property to make my project use this package instead cdn.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

File: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: One or more configured baseBranches are missing from this repo: dev

Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope'

Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:3000/node_modules/workbox-cdn/workbox/workbox-sw.js' failed to load.
at http://localhost:3000/sw.js:3:1
(anonymous) @ sw.js:3

nuxt.config.js
workbox: {
dev: isDev,
workboxURL: './node_modules/workbox-cdn/workbox/workbox-sw.js',
config: {
modulePathPrefix: './node_modules/workbox-cdn/workbox',
},
// offlineStrategy:NetworkOnly,
offlineAssets:['/favicon.ico','/favicon.png', '/offlinefallback'],
offlinePage:'/offlinefallback',
}

this error also exists on online mode
specially when you transit between the pages.
تقویم و تاریخ امروز
تقویم
تاریخ امروز
when you use "/" at the end of the url the problem exists either.
تقویم و تاریخ امروز
تقویم
تاریخ امروز
https://www.zamanha.ir

any help is appreciable.
@pi0
@Atinux
@SukkaW

Cannot serve all files locally

The current workbox-sw.js in the npm package contains the URL for JSDelivr CDN.

Even if the workbox directory is served locally, after fetching workbox-sw.js, other files will be still fetched from JSDelivr CDN, instead of the local directory.

no-response error occurs sometimes

I am using latest nuxt version.
while develop or deploy to site after build, sometimes I can see no-response error via workbox-cdn package.
I attached screenshot.
image
what's the reason?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.