You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check if updating to the latest Preact version resolves the issue
Describe the bug
Throwing an error within a Preact application with preact/debug enabled always logs the following warning in the dev console:
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.
Adding @babel/plugin-transform-react-jsx-source to my babel configuration does not stop the warning.
This warning is logged from here in component-stack.js.
'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.'
);
}
Looking at that file, I don't believe that hasBabelPlugin is ever set to true before this warning gets logged. Unfortunately, I don't know how to detect the presence or absence of a babel plugin, otherwise I'd suggest a patch!
To Reproduce
(I could not reproduce this in the provided codesandbox environment, maybe because it's using react-error-overlay?)
Create a new Preact application using the latest version of preact-cli: npx preact-cli create default lol2 (or following instructions for a webpack - babel build)
Put an undefined variable into <App /> like the following:
Expected behavior
The error is logged without an accompanying warning about a missing babel plugin if the babel plugin has, in fact, been loaded. Though I was not able to see any difference in output with the plugin installed or removed.
The text was updated successfully, but these errors were encountered:
Unfortunately it's not possible for us to correct the message for Preact-CLI users, due to the way CLI renders to the root element. While we definitely recommend migrating off of Preact-CLI, we certainly understand that's not always possible, so if the warning continues to bother anyone, best option would be to patch it.
For those who don't use Preact-CLI, you can disregard this, we should have a fix.
Describe the bug
Throwing an error within a Preact application with
preact/debug
enabled always logs the following warning in the dev console:Adding
@babel/plugin-transform-react-jsx-source
to my babel configuration does not stop the warning.This warning is logged from here in
component-stack.js
.preact/debug/src/component-stack.js
Lines 90 to 95 in d4089df
Looking at that file, I don't believe that
hasBabelPlugin
is ever set totrue
before this warning gets logged. Unfortunately, I don't know how to detect the presence or absence of a babel plugin, otherwise I'd suggest a patch!To Reproduce
(I could not reproduce this in the provided codesandbox environment, maybe because it's using
react-error-overlay
?)Example repo: https://github.com/imidom/preact-warning-example
preact-cli
:npx preact-cli create default lol2
(or following instructions for a webpack - babel build)<App />
like the following:npm run dev
Expected behavior
The error is logged without an accompanying warning about a missing babel plugin if the babel plugin has, in fact, been loaded. Though I was not able to see any difference in output with the plugin installed or removed.
The text was updated successfully, but these errors were encountered: