-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addressing issue #1862 by filtering out Boolean values from the plugins list #1927
Conversation
… plugins list in the config.
app/config/init.js
Outdated
@@ -36,6 +36,8 @@ const _init = function (cfg) { | |||
notify('Error reading configuration: `config` key is missing'); | |||
return _extractDefault(cfg.defaultCfg); | |||
} | |||
// Ignore undefined values in plugin array Issue #1862 | |||
_cfg.plugins = _cfg.plugins.filter(Boolean); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could _cfg.plugins
be undefined
? If yes we should check it:
_cfg.plugins = (_cfg.plugins && _cfg.plugins.filter(Boolean)) || [];
localPlugins
should be filtered too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right! Will add that. About localPlugins
I was thinking that it is dev only, so thought it's not needed to run through that check each time unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If localPlugins
is empty, it will do nothing. It is pretty useless you're right, but it is better for consistency imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 nice, the config file needs more validation, like check Array.isArray
etc, but this will do for now :)
… plugins list (vercel#1927) * Addressing issue vercel#1862 by filtering out Boolean values from the plugins list in the config. * Updating the PR based on review comments.
This adds the
.filter(Boolean)
to filter out the undefined values in the config plugins array.