-
-
Notifications
You must be signed in to change notification settings - Fork 3
Add support for the automatic dev runtime #2
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
Changes from 6 commits
8f6309d
7bac503
e3ea95e
2fab741
fff3d99
9fbb1bc
543b4ff
c6ac054
ecc7a6a
9585e87
09710c2
66e0051
e8b8bc5
1cb4fc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -113,6 +113,16 @@ runtime is automatic (`string`, default: `'react'`). | |||||||||||||
| Comment: `@jsxImportSource theSource`. | ||||||||||||||
| Note that `/jsx-runtime` is appended to this provided source. | ||||||||||||||
|
|
||||||||||||||
| ##### `options.development` | ||||||||||||||
|
|
||||||||||||||
| If the automatic runtime is used, this compiles JSX into automatic runtime | ||||||||||||||
| development mode (`boolean`, default: `false`). | ||||||||||||||
|
||||||||||||||
| If the automatic runtime is used, this compiles JSX into automatic runtime | |
| development mode (`boolean`, default: `false`). | |
| Add location info on where a component originated from (`boolean`, default: | |
| `false`). | |
| This helps debugging but adds a lot of code that you don’t want in production. | |
| Only used when `filePath` is and in the automatic runtime. |
Btw: does React still show somewhat useful info without a filePath? Maybe we could still do something with line/column without and lift the restriction? Maybe more confusing but potentially we could default to '<source.js>' or so even?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it doesn’t show anything?
And what if we use '<source.js>'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My screenshot was a bit unclear. This error view replaces what would normally be the part that display component details.
Anyway, showing <source.js> looks fine. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I’m interested whether you have a screenshot that shows this, because I haven’t seen it yet!
Glad a fake name is somewhat useful!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
I created the following Next.js page in recma-nextjs-static-props, then tweaked the source parameters:
import { jsxDEV } from 'react/jsx-dev-runtime'
export default function Foo() {
return jsxDEV(
'p',
{ children: 'Hello world!' },
'key',
false,
{
fileName: '/home/remco/Projects/recma-nextjs-static-props/pages/foo.jsx',
lineNumber: 35,
columnNumber: 42,
},
this,
)
}Using the React devtools chrome extension, it looks like this:
The source copy button copies /home/remco/Projects/recma-nextjs-static-props/pages/foo.jsx:35 to the clipboard. This format can be copied directly into the VSCode file search for example
The Log this component data to the console button logs the following positional data to the console:
With removed positional information, it looks like this:
With a removed filename, it looks like this:
With source set to undefined, it looks like this:
And just for you, a screenshot with fileName set to <source.js>. 😄







Uh oh!
There was an error while loading. Please reload this page.