feat(helpers): Handle Vite config objects declared as variables in addVitePlugin
#69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
This sort of addresses #68 but only for
addVitePlugin
and in a less universal way. Still happy to work on #68 if the proposal is accepted but I'd like to contribute this fix first so that we can unblock our usage ofmagicast
.❓ Type of change
📚 Description
This PR adds support for handling vite configs that are not directly exported as default objects in
addVitePlugin
.Currently, a code snippet like
causes
addVitePlugin
to throw withWith this PR, we take the identifier for the default export (if it exists), look up its declaration and if we find it, modify it. Admittedly, the modification and writing back part of this fix is a little messy. With my limited knowledge of the codebase, I think this is as much as we can do, until we come up with a better, general API for modifying declarations (see #68). Happy to be proven wrong though :) (i might need some guidance in that case to do better).
📝 Checklist
Happy to update the readme but first I'd like to know if this has potential to be merged ;)