-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
feat: let plugins
array contain falsy values
#1649
Conversation
d69f43b
to
9f31b5b
Compare
@aleclarson Could you provide a description why this is useful? |
@@ -67,7 +69,7 @@ export interface UserConfig { | |||
/** | |||
* Array of vite plugins to use. | |||
*/ | |||
plugins?: (Plugin | Plugin[])[] | |||
plugins?: (PluginOption | PluginOption[])[] |
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.
question: In which situation is an array with possible falsy values helpful?
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.
@matias-capeletto Is it wanted behavior that plugins can hold an array of array of plugins? Looks weird, but I currently don't know better.
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, it is used to create presets, a plugin can return several plugins. You can check out the vue plugin for an example
@@ -43,6 +43,8 @@ export function defineConfig(config: UserConfigExport): UserConfigExport { | |||
return config | |||
} | |||
|
|||
export type PluginOption = Plugin | false | null | undefined |
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.
suggestion (if-minor): The PluginOption
itself should not be undefined
The plugin
property is already marked as optional
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.
For reference, rollup also ignore falsy plugins: https://rollupjs.org/guide/en/#plugins
Falsy plugins will be ignored, which can be used to easily activate or deactivate plugins.
No description provided.