Open brunosc opened 6 years ago
please, someone give us a light!
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/'
})
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?