Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX transform: add the debug source information #2318

Closed
kirillrogovoy opened this issue Jun 14, 2022 · 1 comment · Fixed by #2349
Closed

JSX transform: add the debug source information #2318

kirillrogovoy opened this issue Jun 14, 2022 · 1 comment · Fixed by #2349

Comments

@kirillrogovoy
Copy link

kirillrogovoy commented Jun 14, 2022

Most other compilers, namely Typescript and Babel, support a "dev" mode when the compiled code would include the 5th argument of the react/jsx-dev-runtime function call which provides the data on the original source file.

return jsx(
  'div',
  {
    children: [
      jsx(
        'h1',
        { children: 'Hello, world!' },
        void 0,
        false,
+       { fileName: _jsxFileName, lineNumber: 14, columnNumber: 5 },
        this,
      ),
      'text text',
    ],
  },
  void 0,
  true,
+ { fileName: _jsxFileName, lineNumber: 13, columnNumber: 9 },
  this,
)

Reference:

Some tools, such as impulse, leverage that data in dev runtime.

Once there's support for the new runtime API, it should be trivial to implement.

I'm ready to contribute, but I need help with higher-level design decisions.

Related to #334

@alexgorbatchev
Copy link

Also, https://github.com/ericclemmons/click-to-component relies on this, which is an amazing tool for large multi-team projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants