We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi folks,
I'm adding sync task to my service worker but it's doesn't work.
adm-webapp/build/webpack.prod.conf.js
new SWPrecacheWebpackPlugin({ cacheId: 'adm-webapp', filename: 'service-worker.js', staticFileGlobs: ['dist/**/*.{js,html,css}'], minify: true, stripPrefix: 'dist/', importScripts: [ { fileName: utils.assetsPath('js/custom-sw.js') } ] ...
adm-webapp/static/js/custom-sw.js
self.addEventListener('sync', function(event) { console.log('[Service Worker] Background syncing', event); console.log(event.tag); })
If I look "source" tab on Chrome, the custom-sw.js is not loaded
So I added this import script but still not working
adm-webapp/index.html <script type="text/javascript" src="<%= htmlWebpackPlugin.files.publicPath %>static/js/custom-sw.js"></script>
<script type="text/javascript" src="<%= htmlWebpackPlugin.files.publicPath %>static/js/custom-sw.js"></script>
What's wrong?
The text was updated successfully, but these errors were encountered:
please, someone give us a light!
Sorry, something went wrong.
I loaded my custom-service worker with the following:
new CopyWebpackPlugin([ { from: path.resolve(__dirname, '../static'), to: config.build.assetsSubDirectory, ignore: ['.*'] }, { // copy custom service worker from: path.resolve(__dirname, '../src/firebase-messaging-sw.js'), to: config.build.assetsRoot + '/[name].js', transform: (content, path) => { // and transpile it while copying return babel.transformFileSync(path).code } } ]), // service worker caching new SWPrecacheWebpackPlugin({ cacheId: 'teste', importScripts: [ { // transformed custom-service-worker (es6 -> js) filename: 'firebase-messaging-sw.js' } ], filename: 'service-worker.js', staticFileGlobs: ['dist/**/*.*'], minify: true, stripPrefix: 'dist/' })
No branches or pull requests
Hi folks,
I'm adding sync task to my service worker but it's doesn't work.
adm-webapp/build/webpack.prod.conf.js
adm-webapp/static/js/custom-sw.js
If I look "source" tab on Chrome, the custom-sw.js is not loaded
So I added this import script but still not working
adm-webapp/index.html
<script type="text/javascript" src="<%= htmlWebpackPlugin.files.publicPath %>static/js/custom-sw.js"></script>
What's wrong?
The text was updated successfully, but these errors were encountered: