From 7f601db3499e8d4e44f76ddfa32f9cf8a00fc4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 22 May 2025 10:36:54 +0200 Subject: [PATCH] feat(build,config) disable config whitelist in dev mode Webpack will replace the code so the added condition because `if (true)` in dev mode, which helps when one wants to override anything for testing. --- react/features/base/config/functions.any.ts | 7 +++++++ webpack.config.js | 3 +++ 2 files changed, 10 insertions(+) diff --git a/react/features/base/config/functions.any.ts b/react/features/base/config/functions.any.ts index 44b41878f9..a12f7316c9 100644 --- a/react/features/base/config/functions.any.ts +++ b/react/features/base/config/functions.any.ts @@ -193,6 +193,13 @@ export function overrideConfigJSON(config: IConfig, interfaceConfig: any, json: * that are whitelisted. */ export function getWhitelistedJSON(configName: 'interfaceConfig' | 'config', configJSON: any): Object { + // Disable whitelisting in dev mode. + if (typeof __DEV__ !== 'undefined' && __DEV__) { + logger.warn('Whitelisting is disabled in dev mode, accepting any overrides'); + + return configJSON; + } + if (configName === 'interfaceConfig') { return pick(configJSON, INTERFACE_CONFIG_WHITELIST); } else if (configName === 'config') { diff --git a/webpack.config.js b/webpack.config.js index cde1e404f3..02bf79b4e4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -288,6 +288,9 @@ module.exports = (_env, argv) => { plugins: [ ...config.plugins, ...getBundleAnalyzerPlugin(analyzeBundle, 'app'), + new webpack.DefinePlugin({ + '__DEV__': !isProduction + }), new webpack.IgnorePlugin({ resourceRegExp: /^canvas$/, contextRegExp: /resemblejs$/