Skip to content

Commit

Permalink
Patched up react-devtools-core Webpack configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 14, 2019
1 parent 58b39c6 commit 45dff31
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 29 deletions.
60 changes: 32 additions & 28 deletions packages/react-devtools-core/src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,34 +189,38 @@ export function connectToDevTools(options: ?ConnectOptions) {
}
};

Object.defineProperty(
hook,
'resolveRNStyle',
({
enumerable: false,
get() {
return lazyResolveRNStyle;
},
set(value) {
lazyResolveRNStyle = value;
initAfterTick();
},
}: Object),
);
Object.defineProperty(
hook,
'nativeStyleEditorValidAttributes',
({
enumerable: false,
get() {
return lazyNativeStyleEditorValidAttributes;
},
set(value) {
lazyNativeStyleEditorValidAttributes = value;
initAfterTick();
},
}: Object),
);
if (!hook.hasOwnProperty('resolveRNStyle')) {
Object.defineProperty(
hook,
'resolveRNStyle',
({
enumerable: false,
get() {
return lazyResolveRNStyle;
},
set(value) {
lazyResolveRNStyle = value;
initAfterTick();
},
}: Object),
);
}
if (!hook.hasOwnProperty('nativeStyleEditorValidAttributes')) {
Object.defineProperty(
hook,
'nativeStyleEditorValidAttributes',
({
enumerable: false,
get() {
return lazyNativeStyleEditorValidAttributes;
},
set(value) {
lazyNativeStyleEditorValidAttributes = value;
initAfterTick();
},
}: Object),
);
}
}
};

Expand Down
11 changes: 11 additions & 0 deletions packages/react-devtools-core/webpack.backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if (!NODE_ENV) {
process.exit(1);
}

const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');

const __DEV__ = NODE_ENV === 'development';

const GITHUB_URL = getGitHubURL();
Expand All @@ -30,6 +32,15 @@ module.exports = {
library: 'ReactDevToolsBackend',
libraryTarget: 'umd',
},
resolve: {
alias: {
react: resolve(builtModulesDir, 'react'),
'react-dom': resolve(builtModulesDir, 'react-dom'),
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
'react-is': resolve(builtModulesDir, 'react-is'),
scheduler: resolve(builtModulesDir, 'scheduler'),
},
},
plugins: [
new DefinePlugin({
__DEV__: true,
Expand Down
11 changes: 11 additions & 0 deletions packages/react-devtools-core/webpack.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if (!NODE_ENV) {
process.exit(1);
}

const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');

const __DEV__ = NODE_ENV === 'development';

const GITHUB_URL = getGitHubURL();
Expand All @@ -29,6 +31,15 @@ module.exports = {
library: '[name]',
libraryTarget: 'commonjs2',
},
resolve: {
alias: {
react: resolve(builtModulesDir, 'react'),
'react-dom': resolve(builtModulesDir, 'react-dom'),
'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
'react-is': resolve(builtModulesDir, 'react-is'),
scheduler: resolve(builtModulesDir, 'scheduler'),
},
},
plugins: [
new DefinePlugin({
__DEV__: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ By default DevTools listen to port `8097` on `localhost`. If you need to customi

## Developing

* Run `yarn run backend:watch` and `yarn run standalone:watch` in `../react-devtools-core`
* Run `yarn start:backend` and `yarn start:standalone` in `../react-devtools-core`
* Run `yarn start` in this folder
* Refresh the app after it has recompiled a change
* For React Native, copy `react-devtools-core` to its `node_modules` to test your changes.

0 comments on commit 45dff31

Please sign in to comment.