简体   繁体   English

Chrome 开发者工具源不显示源文件

[英]Chrome developer tools sources not showing source files

I'm very new to JavaScript and React, I know that the "Sources” tab in chrome dev tools is supposed to let me look at my JavaScript files in the browser but they aren't. And I think this is why the program is not doing what it meant to.我对 JavaScript 和 React 很陌生,我知道 chrome 开发工具中的“源”选项卡应该让我在浏览器中查看我的 JavaScript 文件,但事实并非如此。我认为这就是该程序的原因没有做它的意思。

index.html- index.html-

<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <title>Project One</title>
    <link rel="stylesheet" href="./semantic-dist/semantic.css" />
    <link rel="stylesheet" href="./style.css" />
    <script src="vendor/babel-standalone.js"></script>
    <script src="vendor/react.js"></script>
    <script src="vendor/react-dom.js"></script>

  </head>

  <body>
    <div class="main ui text container">
      <h1 class="ui dividing centered header">Popular Products</h1>
      <div id="content"></div>
    </div>

    <script src="./js/seed.js"></script>
    <script type="text\babel" data-plugins= "transform-class-properties" src="./js/app.js"></script>
    <!-- Delete the script tag below to get started. -->
  </body>

</html>

app.js-

class ProductList extends React.Component {
  render() {
    return(
      <div className = 'ui unstackable items'>
      Hello Friend!, I am a basic React Component
      </div>
    );
  }`enter code here`
}
ReactDOM.render(
        <ProductList />,
        document.getElementById('content')
);

this question is answered here in this stack overflow post这个问题在这个堆栈溢出帖子中得到了回答

Open the network tab in developer tools and refresh(f5 for shortcut) OR open chrome dev tools -> settings -> Restore default and restore在开发人员工具中打开网络选项卡并刷新(快捷键为 f5)打开 chrome 开发工具 -> 设置 -> 恢复默认值并恢复

generally it should show you the source file like js files in source tab in chrome dev tools (for shortcut - F12) when you CTRL + P and then search your desire file通常,当您CTRL + P然后搜索您想要的文件时,它应该在 chrome 开发工具的源选项卡中显示源文件,如 js 文件(用于快捷方式 - F12)

and if it is not showing for any obvious reason which is the file you are looking is not being called or used in the current UI page then如果由于任何明显的原因没有显示您正在查找的文件在当前 UI 页面中没有被调用或使用,那么

Opened the network tab in developer tools and refresh在开发者工具中打开网络选项卡并刷新

if not works then如果不起作用,那么

open chrome dev tools -> settings -> Restore default and restore打开chrome开发工具->设置->恢复默认并恢复

I know that the "Sources” tab in chrome dev tools is supposed to let me look at my JavaScript files in the browser but they aren't.我知道 chrome 开发工具中的“源”选项卡应该让我在浏览器中查看我的 JavaScript 文件,但事实并非如此。

You add a directory, typically your-project/src via a dialog shown by Chrome.您可以通过 Chrome 显示的对话框添加一个目录,通常是your-project/src Then Chrome displays a narrow horizontal bar at the top of browser's window asking you to confirm Chrome's access to the chosen disk directory.然后 Chrome 在浏览器窗口顶部显示一个窄水平条,要求您确认 Chrome 对所选磁盘目录的访问权限。 The bar is easy to overlook.酒吧很容易被忽视。

Once you added a directory, it's not of much use if you cannot set breakpoints.一旦你添加了一个目录,如果你不能设置断点,它就没有多大用处了。 Chrome needs source maps for that. Chrome 需要源映射。 If source maps are loaded then Chrome superimposes a green dot on the icon of each source file indicating the breakpoints inside this file can be set.如果加载了源映射,则 Chrome 会在每个源文件的图标上叠加一个绿点,指示可以设置该文件内的断点。

Looks like you are using semantic-ui with react.看起来你正在使用语义 UI 和反应。 If you would like to have a boilerplate project with all that set up and detailed debugging instructions related to Chrome and its 'Sources' tab, then have a look at crisp-react如果您想要一个样板项目,其中包含与 Chrome 及其“源”选项卡相关的所有设置和详细调试说明,请查看清晰反应

Tried quite a few solutions to this issue none of them worked for my (.Net Core) application simply because I was using the customised appSettings.Development-myName.json instead of a default appSettings.Development.json... Additionally, the option we choose to browse the application also affected.尝试了很多解决方案来解决这个问题,但它们都不适用于我的(.Net Core)应用程序,因为我使用的是自定义的 appSettings.Development-myName.json 而不是默认的 appSettings.Development.json ......此外,该选项我们选择浏览的应用程序也受到影响。 In my case, a combination of default appSettings.Development.json and IIS Express to debug the app was a success.就我而言,默认 appSettings.Development.json 和 IIS Express 的组合来调试应用程序是成功的。 Thanks!谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Chrome开发者工具来源未正确显示javascript文件 - Chrome developer tools sources not showing javascript files correctly 使用链接开源Google Chrome开发者工具来源标签 - Use link to open source Google Chrome Developer Tools Sources tab 无法将文件添加到chrome开发人员工具源工作区 - Unable to add files to chrome developer tools sources workspace Google Chrome开发人员工具的源代码栏中的这些都是什么? - What are all these things under the sources bar of Google Chrome developer tools? 如何在左侧的Chrome开发人员工具Javascript控制台上显示源文件的名称? - How to display the source files' names on the left hand side Chrome developer tools Javascript console? Javascript文件未出现在chrome开发人员工具中 - Javascript files not appearing in chrome developer tools 有没有办法在Chrome Developer工具中评估源地图中的变量? - Is there a way to evaluate variable in source map inside the Chrome Developer tools? 从开发者工具调试 Chrome Javascript 引擎源代码 - Debugging Chrome Javascript engine source code from Developer Tools Chrome开发人员工具未显示带有请求标头的xhr大小 - Chrome developer tools not showing xhr size with request headers Chrome开发人员工具控制台显示了褪色的Javascript对象属性,为什么? - Chrome developer tools console showing faded Javascript object property, why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM