Skip to content
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

Fix issue where passing the server config disables inline config #140

Merged
merged 2 commits into from
Aug 11, 2024

Conversation

Vija02
Copy link
Contributor

@Vija02 Vija02 commented Jul 25, 2024

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, and build. This means that if the user passes the server config, this check will be wrong.

But the question is why do we need that in the first place? The mergeConfig 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 a ResolvedConfig
image

@szymmis
Copy link
Owner

szymmis commented Aug 11, 2024

Hi @Vija02, sorry for such delay. It seems that the tests are passing and your changes make sense. To be honest I don't have a reason to explain why I've checked it in such a fragile way so thanks a lot for finding a more elegant way of doing that.

@szymmis szymmis merged commit 4a79121 into szymmis:master Aug 11, 2024
1 check passed
@szymmis
Copy link
Owner

szymmis commented Aug 11, 2024

Your changes were shipped in v0.18.0. Thanks a lot for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants