Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Difference between excluding plugin from plugins array and enabled property?

default discord avatar
jeffreyarts2 years ago
2

On the plugin "how-to" page I read that it is bes practice to add an enabled property to my plugin. I was curious on why? Wouldn't it be better to not include the plugin at all? Is this because of some future desire to enable/disable plugins from the admin UI? Or am I missing something?

  • discord user avatar
    denolfe
    2 years ago

    For V2, the plugins needed to have webpack aliases for their server-side code. What many devs tried to do was conditionally including a plugin, but this would cause them to receive webpack errors because the code was being included and not aliased.



    The enabled property convention was introduced so that even if the plugin was not being used, it's webpack aliases would still run, preventing errors.

  • default discord avatar
    jeffreyarts2 years ago

    Thanks, I'll immediatly move my checks up, so that the method will be escaped before the webpack code will run

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.