How can I know if a plugin is enabled in another plugin? #193
-
My basic question is, how can a plugin know if the plugin it want to use is enabled or not. e.g.: my sitemap and seo plugin would both want git plugin to be enabled. If I redeclare plugins to make sure they are enabled, I will get errors like
And this can be awful when I am using:
when I want them to be able to work standalone and in one theme Common idea are:
I hope one of them above can be achieved, or there is something which I can do to avoid the warning. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
You can use following snippet to detect if a plugin has already been used: TBH, supporting nested plugins does have this kind of tradeoff.
|
Beta Was this translation helpful? Give feedback.
You can use following snippet to detect if a plugin has already been used:
https://github.com/vuepress/vuepress-next/blob/5e96641b8d2dd947372222e0af2ea47729afbada/packages/%40vuepress/core/src/app/appUse.ts#L17-L32
TBH, supporting nested plugins does have this kind of tradeoff.