mapbox-gl
删除token
校验
mapbox-gl
通过修改源码的方式删除token
校验
目前只针对
2.15.x
版本,其他版本未知
从github
拉取源码, 找到下图的文件
注释下图的代码
运行yarn build-prod-min
打包
打包之后的文件存在于dist/mapbox-gl.js
修改之前
修改之后
通过修改打包之后的源码
this._requestManager._customAccessToken,(t=>{if(t&&(t.message===e.AUTH_ERR_MSG||401===t.status)){const t=this.painter.context.gl;e.storeAuthState(t,!1),this._logoControl instanceof Jo&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")));}})
修改为
this._requestManager._customAccessToken,(t=>{})