Javascript ESRI:无法解析源映射
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36051891/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ESRI : Failed to parse source map
提问by AhammadaliPK
I am getting this error in the Google chrome developer console.
我在 Google chrome 开发人员控制台中收到此错误。
Failed to parse SourceMap: http://localhost:15132/Scripts/_External/igniteui/css/themes/infragistics/infragistics.theme.css.map
无法解析 SourceMap: http://localhost:15132/Scripts/_External/igniteui/css/themes/infragistics/infragistics.theme.css.map
How do I fix it?
我如何解决它?
回答by Steropes
Chrome recently added support for source maps in the developer tools. If you go under settings on the chrome developer toolbar you can see the following two options:
Chrome 最近在开发人员工具中添加了对源映射的支持。如果您在 chrome 开发人员工具栏上的设置下,您可以看到以下两个选项:
If you disable those two options, and refresh the browser, it should no longer ask for source maps.
如果禁用这两个选项并刷新浏览器,它应该不再要求源映射。
These settings can be found here:
这些设置可以在这里找到:
回答by Chemist
While the chosen answer is a good answer to hide the error, it doesn't make the error go away, it's just that you can't see it in the inspector. The other way would be to download the missing map file and put it in the assets/lib directory. So, for example, I was missing angular-route.min.js.map
file and I went here https://code.angularjs.org/1.5.3/(to the correct version of angular) and downloaded the missing file. The error didn't disappear right away, possibly because of caching, but once I went to the actual file in the browser it worked. http://sitename.localhost/assets/lib/angular-route.min.js.map
. Now the inspector no longer displays the error even with source maps enabled.
虽然选择的答案是隐藏错误的好答案,但它不会使错误消失,只是您在检查器中看不到它。另一种方法是下载丢失的地图文件并将其放在 assets/lib 目录中。因此,例如,我丢失了angular-route.min.js.map
文件,我到这里https://code.angularjs.org/1.5.3/(到正确的 angular 版本)并下载了丢失的文件。错误没有立即消失,可能是因为缓存,但是一旦我在浏览器中转到实际文件,它就起作用了。http://sitename.localhost/assets/lib/angular-route.min.js.map
. 现在,即使启用了源映射,检查器也不再显示错误。
回答by Vicky
Further to just simply turning off Source Maps in Chrome - I've done a little digging and found that using Web Essentials to create the source maps seems to be the issue.
除了在 Chrome 中简单地关闭 Source Maps 之外 - 我做了一些挖掘,发现使用 Web Essentials 创建源映射似乎是问题所在。
For whatever reason, if I use an external compiler (Koala) I can successfully create working source maps in Chrome (no errors). Whereas if I use Web Essentials, the source maps fail to parse.
无论出于何种原因,如果我使用外部编译器(Koala),我可以在 Chrome 中成功创建工作源映射(没有错误)。而如果我使用 Web Essentials,源映射将无法解析。
Hope this helps someone.
希望这可以帮助某人。
回答by Wasim A.
Source code of CSS/JS we usually minified/compress. Now if we want to debug those minified files then we have to add following line at the end of minified file
我们通常缩小/压缩的 CSS/JS 源代码。现在,如果我们想调试那些缩小的文件,那么我们必须在缩小的文件末尾添加以下行
/*# sourceMappingURL=bootstrap.min.css.map */
This tells compiler where is source file actually mapped.
这告诉编译器源文件实际映射到哪里。
In the case of JSits make sense
but in the case of CSS, its actually debugging of SCSS.
在JS的情况下,它是有意义的,
但在CSS的情况下,它实际上是对 SCSS 的调试。
To Remove Warning:remove /*# sourceMappingURL=bootstrap.min.css.map */ from the end of minified file
, .
删除警告:remove /*# sourceMappingURL=bootstrap.min.css.map */ from the end of minified file
, 。
回答by Artem Solovev
I had the same problem because .htaccess
has incorrect settings:
我遇到了同样的问题,因为.htaccess
设置不正确:
RewriteEngine on
RewriteRule !.(js|gif|jpg|png|css)$ index.php
RewriteRule 上的RewriteEngine !.(js|gif|jpg|png|css)$ index.php
I solved this by modifying the file:
我通过修改文件解决了这个问题:
RewriteEngine on
RewriteRule !.(js|gif|jpg|png|css|eot|svg|ttf|woff|woff2|map)$ index.php
RewriteRule 上的RewriteEngine !.(js|gif|jpg|png|css|eot| svg| ttf| woff| woff2| map)$ index.php
回答by Vael Victus
This may sometimes be caused by Chrome extensions you've installed. For example, AdBlock.
这有时可能是由您安装的 Chrome 扩展程序引起的。例如, AdBlock。
Unfortunately the best solution I could find was to disable the offending extension.
不幸的是,我能找到的最佳解决方案是禁用有问题的扩展。
回答by robstarbuck
When I had this issue the cause was a relative reference to template files when using the ui.bootstrap.modalmodule.
当我遇到这个问题时,原因是使用ui.bootstrap.modal模块时对模板文件的相对引用。
templateUrl: 'js/templates/modal.html'
templateUrl: 'js/templates/modal.html'
This works from a root domain (www.example.com) but when a path is added (www.example.com/path/) the reference breaks. The answer in my case was simply to making the reference absolute (js/-> /js/).
这适用于根域 ( www.example.com),但是当添加路径 ( www.example.com/path/) 时,引用会中断。在我的情况下,答案只是使引用绝对化(js/-> /js/)。
templateUrl: '/js/templates/modal.html'
templateUrl: '/js/templates/modal.html'
回答by Roland Brenevil Jr
The error in the Google DevTools are caused Google extensions.
Google DevTools 中的错误是由 Google 扩展引起的。
- I clicked on my Google icon in the browser
- created a guest profile at the bottom of the popup window.
- I then pasted my localhost address and voila!!
- 我在浏览器中点击了我的 Google 图标
- 在弹出窗口的底部创建了一个访客档案。
- 然后我粘贴了我的本地主机地址,瞧!!
No more errors in the console.
控制台中不再有错误。
回答by Rakshith R Salian
I noticed that problem because of AdBlock Extension, I turned off AdBlock extension the issue got resolve.
我注意到这个问题是因为 AdBlock 扩展,我关闭了 AdBlock 扩展,问题得到了解决。
回答by BolonhaDev
Check if you're using some Chrome extension (Night mode or something else). Disable that and see if the 'inject' gone.
检查您是否正在使用某些 Chrome 扩展程序(夜间模式或其他)。禁用它,看看“注入”是否消失了。