Recently we have supported registration options and its default value is set to { scope: '/' }, but there is a potential problem, if an user didn't pass in registrationOptions, at the same time he/she deployed his/her site at a sub directory, e.g. vuejs.org/sub/. he will meet a error of service worker:
The path of the provided scope ('/') is not under the max scope allowed ('/sub/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.
This is due to the service-worker.js is under vuejs.org/sub/ but the default scope we set is equivalent to vuejs.org/ which causes the leading out of scope. so in that case user'll need to override registrationOptions.
Motivation
Recently we have supported registration options and its default value is set to
{ scope: '/' }
, but there is a potential problem, if an user didn't pass in registrationOptions, at the same time he/she deployed his/her site at a sub directory, e.g.vuejs.org/sub/
. he will meet a error of service worker:This is due to the service-worker.js is under
vuejs.org/sub/
but the default scope we set is equivalent tovuejs.org/
which causes the leading out of scope. so in that case user'll need to override registrationOptions.Actually, following the mozilla:
So we needn't to set the default value since the native register API will help us to do it.
BTW, actually I guess it should typo of the previous PR, the default value should be
./
instead of/
. but the better is to remove it directly.