DevTools supports ENV-injected version for better internal bug reports (#22635)
Brian Vaughn committed
Oct 27, 2021 at 17:18 UTC
c624dc3598c6dc95f9a827667bc4f8ecff41f0bd
3 files changed
+10
-8
packages/react-devtools-extensions/utils.js
+8
-6
@@ -30,12 +30,14 @@ function getGitCommit() {
30
}
31
}
32
33
-function getVersionString() {
34
- const packageVersion = JSON.parse(
35
- readFileSync(
36
- resolve(__dirname, '..', 'react-devtools-core', './package.json'),
37
- ),
38
- ).version;
33
+function getVersionString(packageVersion = null) {
34
+ if (packageVersion == null) {
35
+ packageVersion = JSON.parse(
36
+ readFileSync(
37
+ resolve(__dirname, '..', 'react-devtools-core', './package.json'),
38
+ ),
39
+ ).version;
40
+ }
41
42
const commit = getGitCommit();
43
packages/react-devtools-extensions/webpack.backend.js
+1
-1
@@ -30,7 +30,7 @@ const builtModulesDir = resolve(
30
31
const __DEV__ = NODE_ENV === 'development';
32
33
-const DEVTOOLS_VERSION = getVersionString();
33
+const DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
34
35
const featureFlagTarget = process.env.FEATURE_FLAG_TARGET || 'extension-oss';
36
packages/react-devtools-extensions/webpack.config.js
+1
-1
@@ -30,7 +30,7 @@ const builtModulesDir = resolve(
30
31
const __DEV__ = NODE_ENV === 'development';
32
33
-const DEVTOOLS_VERSION = getVersionString();
33
+const DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
34
35
const LOGGING_URL = process.env.LOGGING_URL || null;
36