Service worker on cordova app
-
I have found a way to add a service worker using this post
http://forum.quasar-framework.org/topic/134/serve-file-from-root-in-dev-server, it works fine in development but when I create the cordova app the service worker is not available and can’t be registered in my app. How should I solve this problem anyone has experience with this? -
@boriscy Hi, use Copy Webpack Plugin (https://github.com/kevlened/copy-webpack-plugin) to copy your service worker files to
/dist
folder in/build/webpack.prod.conf.js
. -
I have the CopyWebpack Plugin and I have not set the to folder is it ok to use this
new CopyWebpackPlugin([ { from: 'root/', to: '/dist/root' } ])
-
to
must be set todist
as you probably want those files in the root of your app. -
Solution:
Just use this config to copy to the root folder, it will copy all files todist/
folder when you runquasar build
new CopyWebpackPlugin([ { from: 'root/', to: '' } ])