debugging - 尽管 webpack 源映射,jsx React 调试器仍不匹配

标签 debugging google-chrome-devtools reactjs source-maps

我正在学习 React 和 JSX 并使用 webpack 进行编译,但是当我将“调试器”放入我的组件中时,当我在 Chrome 开发工具的“源”选项卡中时,该行不匹配(通常源不匹配)根本不反射(reflect)我的 app.jsx 文件中的内容)。 React 选项卡也没有真正加载。下面是我的 webpack.config:

module.exports = {
  context: __dirname,
  entry: "./api_assignment.jsx",
  output: {
    path: "./",
    filename: "bundle.js"
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          presets: ['react']
        }
      }
    ]
  },
  devtool: 'source-map',
  resolve: {
    extensions: ["", ".js", ".jsx"]
  }
};

enter image description here

//Webpack截图

enter image description here

enter image description here

最佳答案

如果您从本地文件而不是 webpack 服务器加载 html,则需要启用 React Developer Tools 扩展选项“允许访问文件 URL”。

关于debugging - 尽管 webpack 源映射,jsx React 调试器仍不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35964563/

相关文章:

linux - 在 GDB 中删除用户定义的命令

java - 为什么使用 "while(amount >= 0)"会导致无限 while 循环?

debugging - D-Bus 通过 d-feet 发送变体

google-chrome-devtools - 如何在 Chrome 中调试长脚本?

javascript - 如何在 Chrome/FF 中执行/页面加载之前修改内联 JS?

node.js - 实时调试 Nodejs 应用程序?

css - Chrome 开发者工具 : SASS source file doesn't get saved on disk

javascript - react JS : How to send an event down the component tree?

javascript - Redux API 并发操作的最佳实践

reactjs - material-ui reactjs中的嵌套抽屉