-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow conditionally enabling the module #59
Comments
Great idea! I've seen |
From my perspective, it depends on the module. This one sounds like a good one to have the It would be as easy as adding the following snippet at the start of the module setup function:
|
What I generally dislike about this approach for a But yeah, if other modules provide this option that it might be best to add support for |
Would you say more about how this approach might break auto-imports? If we return from the module's setup function early, none of the imports/plugins will be added. Let me know if there's something more to consider here I might have overlooked 😄 Line 119 in 4f6a634
Line 128 in 4f6a634
And, to be very clear, we are talking about disabling the module conditionally, when the condition is some form of a variable. |
I know what you mean now. Yes, the code using whatever this module exports will break when
... but, this would mean we would have to add the config with the same condition (and just checked that we lose autocompletion for module config by doing it this way):
What do you think? |
Describe the feature
Currently, there doesn't seem to be a way to conditionally enable the module. This is what I would ideally imagine:
Sadly,
enabled
is used for a different purpose, which is confusing. Could we consider renaming currentenabled
option to a more descriptive one, please (e.g.initializationMode: 'auto' | 'manual'
)? (Yes, this would be a breaking change but worth it in my opinion.)Additional information
Final checks
The text was updated successfully, but these errors were encountered: