Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

service worker - not being generated #110

Open
ashishtilara opened this issue Sep 25, 2019 · 1 comment
Open

service worker - not being generated #110

ashishtilara opened this issue Sep 25, 2019 · 1 comment

Comments

@ashishtilara
Copy link

when I run

npm init stencil ionic-pwa

the generated code doesn't have service worker file, or package.json doesn't have any mention of start.sw in scripts, is there anything I am missing?

@rafaelbatistamarcilio
Copy link

@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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants