mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
DevTools: Add break-on-warn feature (#19048)
This commit adds a new tab to the Settings modal: Debugging This new tab has the append component stacks feature and a new one: break on warn This new feature adds a debugger statement into the console override
This commit is contained in:
@@ -20,9 +20,14 @@ function startActivation(contentWindow: window) {
|
||||
// so it's safe to cleanup after we've received it.
|
||||
contentWindow.removeEventListener('message', onMessage);
|
||||
|
||||
const {appendComponentStack, componentFilters} = data;
|
||||
const {
|
||||
appendComponentStack,
|
||||
breakOnConsoleErrors,
|
||||
componentFilters,
|
||||
} = data;
|
||||
|
||||
contentWindow.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = appendComponentStack;
|
||||
contentWindow.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = breakOnConsoleErrors;
|
||||
contentWindow.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = componentFilters;
|
||||
|
||||
// TRICKY
|
||||
@@ -33,6 +38,7 @@ function startActivation(contentWindow: window) {
|
||||
// but it doesn't really hurt anything to store them there too.
|
||||
if (contentWindow !== window) {
|
||||
window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = appendComponentStack;
|
||||
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = breakOnConsoleErrors;
|
||||
window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = componentFilters;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@ import Bridge from 'react-devtools-shared/src/bridge';
|
||||
import Store from 'react-devtools-shared/src/devtools/store';
|
||||
import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
|
||||
import {
|
||||
getSavedComponentFilters,
|
||||
getAppendComponentStack,
|
||||
getBreakOnConsoleErrors,
|
||||
getSavedComponentFilters,
|
||||
} from 'react-devtools-shared/src/utils';
|
||||
import {
|
||||
MESSAGE_TYPE_GET_SAVED_PREFERENCES,
|
||||
@@ -38,6 +39,7 @@ export function initialize(
|
||||
{
|
||||
type: MESSAGE_TYPE_SAVED_PREFERENCES,
|
||||
appendComponentStack: getAppendComponentStack(),
|
||||
breakOnConsoleErrors: getBreakOnConsoleErrors(),
|
||||
componentFilters: getSavedComponentFilters(),
|
||||
},
|
||||
'*',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const {resolve} = require('path');
|
||||
const {DefinePlugin} = require('webpack');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const {
|
||||
GITHUB_URL,
|
||||
getVersionString,
|
||||
@@ -36,6 +37,16 @@ module.exports = {
|
||||
'react-is': 'react-is',
|
||||
scheduler: 'scheduler',
|
||||
},
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
compress: {drop_debugger: false},
|
||||
output: {comments: true},
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new DefinePlugin({
|
||||
__DEV__,
|
||||
|
||||
Reference in New Issue
Block a user