-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix: Devtool flag inconsistencies #113
Conversation
src/devtools.ts
Outdated
if (entry === id && (!config.isProduction || injectInProd)) { | ||
const source = injectInProd ? "preact/devtools" : "preact/debug"; | ||
if (entry === id && devToolsEnabled) { | ||
const source = devtoolsInProd ? "preact/devtools" : "preact/debug"; |
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.
I don't quite understand why the source changes based upon whether devtoolsInProd
is enabled or not. Is this correct? This seems wrong to me, but it's perfectly possible I'm missing something.
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.
During production you likely don't want the weight of preact/debug
with all the warnings, just the devtools connection bridge. That's why the switch was originally introduced. The preact/devtools
bridge is <200b .
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.
Oh shoot, I had it in my mind for some reason that devtools pulled in debug, not the other way around. Didn't even double check when confused.
My bad, cheers!
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.
Still, I think this is a bit of a problem as it'd mean enabling it would cause problems with dev, no?
Will correct tomorrow
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.
Should be correct now, will always provide 'preact/debug'
in dev if devToolsEnabled
is set to true
/default, while in prod, you'll get 'preact/devtools'
only if you've enabled devtoolsInProd
.
Non-breaking form of #112
devToolsEnabled
becomes a derived value, formed of the user passed option, whether it's a prod build or not, and the user-passeddevtoolsInProd
option.Still not sure about the devtools source, see below