Skip to content

Commit 8f503d3

Browse files
committed
Remove EnvironmentPlugin
process.env.NODE_ENV is not referenced in any client scripts. process.env.MUSICBRAINZ_RUNNING_TESTS is, but debounce.js is not used in Node, so there's no reason to use process.env here.
1 parent b27261b commit 8f503d3

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

.eslintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ globals:
2424
__webpack_public_path__: writable
2525
__DEV__: readonly
2626
GLOBAL_JS_NAMESPACE: readonly
27+
MUSICBRAINZ_RUNNING_TESTS: readonly
2728
addColon: readonly
2829
addColonText: readonly
2930
hasOwnProp: readonly

root/static/scripts/common/utility/debounce.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function debounceComputed(value, delay) {
2525
if (!ko.isObservable(value)) {
2626
value = ko.computed(value);
2727
}
28-
if (process.env.MUSICBRAINZ_RUNNING_TESTS) {
28+
if (
29+
typeof MUSICBRAINZ_RUNNING_TESTS !== 'undefined' &&
30+
MUSICBRAINZ_RUNNING_TESTS
31+
) {
2932
return value;
3033
}
3134
return value.extend({

root/vars.js

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
declare var __webpack_public_path__: string;
1919
declare var __DEV__: boolean;
2020
declare var GLOBAL_JS_NAMESPACE: '__MB__';
21+
declare var MUSICBRAINZ_RUNNING_TESTS: false;
2122

2223
declare var addColon: (variable: Expand2ReactInput) => Expand2ReactOutput;
2324
declare var addColonText: (variable: StrOrNum) => string;

script/.check_eslint_rule_config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ globals:
2121
__webpack_public_path__: writable
2222
__DEV__: readonly
2323
GLOBAL_JS_NAMESPACE: readonly
24+
MUSICBRAINZ_RUNNING_TESTS: readonly
2425
addColon: readonly
2526
addColonText: readonly
2627
hasOwnProp: readonly

webpack/browserConfig.js

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ module.exports = {
2929
new webpack.IgnorePlugin({
3030
resourceRegExp: /\/DBDefs(?:-client-values)?$/,
3131
}),
32-
33-
new webpack.EnvironmentPlugin({
34-
MUSICBRAINZ_RUNNING_TESTS: false,
35-
NODE_ENV: process.env.NODE_ENV || 'development',
36-
}),
3732
],
3833

3934
resolve: {

webpack/definePluginConfig.js

+2
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ module.exports = {
2020
*/
2121
__DEV__: JSON.stringify(WEBPACK_MODE === 'development'),
2222
GLOBAL_JS_NAMESPACE: JSON.stringify(GLOBAL_JS_NAMESPACE),
23+
MUSICBRAINZ_RUNNING_TESTS:
24+
JSON.stringify(!!process.env.MUSICBRAINZ_RUNNING_TESTS),
2325
};

0 commit comments

Comments
 (0)