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.
This commit is contained in:
Saúl Ibarra Corretgé
2025-05-22 10:36:54 +02:00
committed by Saúl Ibarra Corretgé
parent 26423f8e76
commit 7f601db349
2 changed files with 10 additions and 0 deletions

View File

@@ -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') {

View File

@@ -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$/