Skip to content

Commit

Permalink
fix: Incorrect "missing transform-jsx-source" warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Apr 26, 2024
1 parent aa95aa9 commit 784af46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions debug/src/component-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function getCurrentVNode() {
* location of a component. In that case we just omit that, but we'll
* print a helpful message to the console, notifying the user of it.
*/
let hasBabelPlugin = false;
let shouldShowJsxSourceWarning = true;

/**
* Check if a `vnode` is a possible owner.
Expand Down Expand Up @@ -87,12 +87,12 @@ export function getOwnerStack(vnode) {
const source = owner.__source;
if (source) {
acc += ` (at ${source.fileName}:${source.lineNumber})`;
} else if (!hasBabelPlugin) {
hasBabelPlugin = true;
} else if (shouldShowJsxSourceWarning) {
console.warn(
'Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.'
);
}
shouldShowJsxSourceWarning = false;

return (acc += '\n');
}, '');
Expand Down

0 comments on commit 784af46

Please sign in to comment.