我正在使用服务作品来预取 Google Maps Javascript SDK。因为服务人员使用fetch
我不断收到此错误 -
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
如何在谷歌地图 SDK 上启用 CORS?
更新
我正在使用sw-toolbox,在我的服务人员中我有以下代码 -</p>
import toolbox from 'sw-toolbox'
toolbox.precache([
'/',
'/bundle.js',
'/manifest.json',
'/ola_icon.png',
'/favicon.png',
'https://maps.googleapis.com/maps/api/js?key=myapikey&callback=initMap'
])