Chrome开发工具 - 工作区映射不匹配 [英] Chrome Dev Tools - Workspace mapping mismatch

查看:153
本文介绍了Chrome开发工具 - 工作区映射不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个远程网页,加载一个名为 script.js 的远程JavaScript文件。我没有立即访问远程文件系统来进行测试。



因此,我复制 script.js 我的本地驱动器,并在Chrome开发工具中,我将我的本地文件夹添加到工作区。然后,右键单击我的远程 script.js 文件并选择映射到文件系统资源... 。我选择我的本地 script.js



现在我期望我的语言环境更改为 script.js 来覆盖远程的 script.js ,对吗?这样我可以对我的本地 script.js 进行一些更改,当我重新加载页面时,我可以看到更改反映在我的页面上。



然而,在Sources选项卡中,当选择我的本地 script.js 时,我会看到顶部的警告:

 工作区映射不匹配

该文件在文件系统上的内容:

file:/// Users / me / test / script.js

与加载的脚本不匹配:

http://someserver.com/js/script.js

可能的解决方案是:
- 重新加载检查页面
- 检查您的文件和脚本是否都从正确源码加载并且其内容匹配

所以这告诉我我的本地 script.js 需要和远程的script.js ?如果是这样,那么本地资源的重点是什么?

是不是在那里,您可以对其进行更改并查看浏览器中反映的这些更改?如果它必须与远程文件相匹配,那么您必须有权访问以编辑远程文件,在这种情况下,您将在此处进行更改,而不是在本地文件中进行更改。如果是这样,那么映射本地资源有什么意义?



我在这里错过了什么吗?是否可以在Chrome开发工具中对文件进行临时本地更改,并在页面重新加载时反映这些更改?我认为这是本地文件系统资源的目的。

解决方案

工作区是为映射文件中的同一文件而构建的,通过网络服务。 (如服务〜/代码/应用程序localhost:8000)。

它不适用于替代本地文件。有一些Chrome扩展程序,我建议翻转脚本

I have a remote webpage that loads a remote JavaScript file called script.js. I don't have immediate access to the remote filesystem to make changes to test something.

So I copy script.js to my local drive, and in Chrome Dev Tools I add my local folder to the workspace. Then I right-click on my remote script.js file and pick Map to File System Resource.... I pick my local script.js.

So now I would expect my locale changes to script.js to override the remote script.js, right? This way I can make some changes to my local script.js and when I reload the page I can see the changes being reflected on my page.

However in the Sources tab, when selecting my local script.js I see the warning at the top:

Workspace mapping mismatch

The content of this file on the file system:

file:///Users/me/test/script.js

does not match the loaded script: 

http://someserver.com/js/script.js

Possible solutions are:
- Reload inspected page
- Check that your file and script are both loaded from the correct source and their contents match

So is this telling me that my local script.js needs to be exactly the same as the remote script.js? If so, then what is the point of the local resource?

Isn't it there so that you can make changes to it and see those changes reflected in the browser? If it has to match the remote file, then you must already have access to be able to edit the remote file, in which case you would be making your changes there and not on the local file. If that is the case, then what is the point of having the local resource mapped?

Am I missing something here? Is it not possible to make temporary local changes to a file in Chrome Dev Tools and have those changes be reflected when the page is reloaded? I thought that was the purpose of the Local File System Resources.

解决方案

Workspaces is built to map the same file that's in file and served over the network. (like serving ~/code/app to localhost:8000).

It will not work for serving a local file as a replacement. There are some Chrome extensions for this, I recommend Flip the Script.

这篇关于Chrome开发工具 - 工作区映射不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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