JavaScript源地图:保持地图文件本地只用于调试生产JavaScript [英] javascript source map : keeping map file local only to debug production javascript

查看:107
本文介绍了JavaScript源地图:保持地图文件本地只用于调试生产JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调试生产网站,但我不想在服务器上上传地图文件(出于隐私原因,因为它是公共权利?)。

I would like to debug production website, but I don't want to upload the map file on the server (for privacy reason, because it is public right ?).

是否有可能?

推荐答案

我不相信任何浏览器目前允许从本地文件加载源地图,所以你必须以某种方式使源代码在线。

I don't believe any browsers currently allow loading source maps ondemand from local files, so you have to put the sourcemaps online somehow.

一种解决方案可能是创建一个.htaccess文件(或者类似的东西,如果你不使用Apache)到源图(和原始源文件)到客户端,而不是从您的本地网络。

One solution could be to create a .htaccess file (or something similar, if you aren't using Apache) that restricts access to the sourcemap (and the original source files) to clients that aren't from your local network.

您应该认识到,如果您想阻止访问源图为安全起见,那么您将获得的只是一种虚假的安全感。 Javascript是公开的,即使它被缩小和加密,也很容易解密它。不要 在JavaScript中放入任何敏感数据。即使你对它进行缩小和加密也不行。

You should realize though, that if you want to prevent access to the sourcemaps for security reasons, then all you will achieve is a false sense of safety. Javascript is public, and even if it is minified and encrypted, it is fairly easy to unencrypt it. Do not put any sensitive data in your javascript. Not even if you minify and encrypt it.

这篇关于JavaScript源地图:保持地图文件本地只用于调试生产JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆