Open ashishtilara opened 4 years ago
@ashishtilara there is a file called stencil.config.ts with the following code:
` import { Config } from '@stencil/core';
// https://stenciljs.com/docs/config
export const config: Config = { outputTargets: [{ type: 'www', serviceWorker: null }], globalScript: 'src/global/app.ts', globalStyle: 'src/global/app.css' }; `
If you press CTRL + left mouse button you will see that exists a ServiceWorkerConfig that you can use.
I just change my stencil.config.ts to the following code and the build generate a sw.js
import { Config } from '@stencil/core';
// https://stenciljs.com/docs/config
export const config: Config = { outputTargets: [{ type: 'www', serviceWorker: { cacheId:'v1', } }], globalScript: 'src/global/app.ts', globalStyle: 'src/global/app.css' };
It will be nice if Stencil team improves the service worker docs to give us examples of configurations and examples of service worker features like push notifications and backgroud sync
when I run
the generated code doesn't have service worker file, or
package.json
doesn't have any mention ofstart.sw
inscripts
, is there anything I am missing?