Patched up react-devtools-core Webpack configs
Brian Vaughn committed
Aug 14, 2019 at 11:22 UTC
45dff31a7583ec0778f294b20b86c702f0bbc2b1
4 files changed
+55
-29
packages/react-devtools-core/src/backend.js
+32
-28
@@ -189,34 +189,38 @@ export function connectToDevTools(options: ?ConnectOptions) {
189
}
190
};
191
192
- Object.defineProperty(
193
- hook,
194
- 'resolveRNStyle',
195
- ({
196
- enumerable: false,
197
- get() {
198
- return lazyResolveRNStyle;
199
- },
200
- set(value) {
201
- lazyResolveRNStyle = value;
202
- initAfterTick();
203
- },
204
- }: Object),
205
- );
206
- Object.defineProperty(
207
- hook,
208
- 'nativeStyleEditorValidAttributes',
209
- ({
210
- enumerable: false,
211
- get() {
212
- return lazyNativeStyleEditorValidAttributes;
213
- },
214
- set(value) {
215
- lazyNativeStyleEditorValidAttributes = value;
216
- initAfterTick();
217
- },
218
- }: Object),
219
- );
192
+ if (!hook.hasOwnProperty('resolveRNStyle')) {
193
+ Object.defineProperty(
194
+ hook,
195
+ 'resolveRNStyle',
196
+ ({
197
+ enumerable: false,
198
+ get() {
199
+ return lazyResolveRNStyle;
200
+ },
201
+ set(value) {
202
+ lazyResolveRNStyle = value;
203
+ initAfterTick();
204
+ },
205
+ }: Object),
206
+ );
207
+ }
208
+ if (!hook.hasOwnProperty('nativeStyleEditorValidAttributes')) {
209
+ Object.defineProperty(
210
+ hook,
211
+ 'nativeStyleEditorValidAttributes',
212
+ ({
213
+ enumerable: false,
214
+ get() {
215
+ return lazyNativeStyleEditorValidAttributes;
216
+ },
217
+ set(value) {
218
+ lazyNativeStyleEditorValidAttributes = value;
219
+ initAfterTick();
220
+ },
221
+ }: Object),
222
+ );
223
+ }
224
}
225
};
226
packages/react-devtools-core/webpack.backend.js
+11
@@ -11,6 +11,8 @@ if (!NODE_ENV) {
11
process.exit(1);
12
}
13
14
+const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
15
+
16
const __DEV__ = NODE_ENV === 'development';
17
18
const GITHUB_URL = getGitHubURL();
@@ -30,6 +32,15 @@ module.exports = {
32
library: 'ReactDevToolsBackend',
33
libraryTarget: 'umd',
34
},
35
+ resolve: {
36
+ alias: {
37
+ react: resolve(builtModulesDir, 'react'),
38
+ 'react-dom': resolve(builtModulesDir, 'react-dom'),
39
+ 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
40
+ 'react-is': resolve(builtModulesDir, 'react-is'),
41
+ scheduler: resolve(builtModulesDir, 'scheduler'),
42
+ },
43
+ },
44
plugins: [
45
new DefinePlugin({
46
__DEV__: true,
packages/react-devtools-core/webpack.standalone.js
+11
@@ -11,6 +11,8 @@ if (!NODE_ENV) {
11
process.exit(1);
12
}
13
14
+const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
15
+
16
const __DEV__ = NODE_ENV === 'development';
17
18
const GITHUB_URL = getGitHubURL();
@@ -29,6 +31,15 @@ module.exports = {
31
library: '[name]',
32
libraryTarget: 'commonjs2',
33
},
34
+ resolve: {
35
+ alias: {
36
+ react: resolve(builtModulesDir, 'react'),
37
+ 'react-dom': resolve(builtModulesDir, 'react-dom'),
38
+ 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
39
+ 'react-is': resolve(builtModulesDir, 'react-is'),
40
+ scheduler: resolve(builtModulesDir, 'scheduler'),
41
+ },
42
+ },
43
plugins: [
44
new DefinePlugin({
45
__DEV__: false,
packages/react-devtools/README.md
+1
-1
@@ -92,7 +92,7 @@ By default DevTools listen to port `8097` on `localhost`. If you need to customi
92
93
## Developing
94
95
-* Run `yarn run backend:watch` and `yarn run standalone:watch` in `../react-devtools-core`
95
+* Run `yarn start:backend` and `yarn start:standalone` in `../react-devtools-core`
96
* Run `yarn start` in this folder
97
* Refresh the app after it has recompiled a change
98
* For React Native, copy `react-devtools-core` to its `node_modules` to test your changes.
\ No newline at end of file