Fix issue where passing the server
config disables inline config
#140
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.
There is a check that checks whether the config is resolved through vite or not. The problem is that the check only checks for an object length of greater than 3.
By default, passing inline vite config will have a minimum of 3 because of the default config. See: https://github.com/Vija02/vite-express/blob/a62ab580b9a9944aceecc0fa1ebe63090756711b/src/main.ts#L95
Those config are:
root
,base
, andbuild
. This means that if the user passes theserver
config, this check will be wrong.But the question is why do we need that in the first place? ThemergeConfig
should resolve any inconsistency. And if not, the check should be more robust. I've removed the check and confirmed that it works fine for inline configuration but I've not tested it with the other 2 methods.I've updated it to check for the
assetsInclude
property. From vite's documentation, this property will exist when it is aResolvedConfig