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(vite): prepend base on devtools POST_PATH #2836

Merged
merged 1 commit into from Jul 8, 2023

Conversation

flipace
Copy link
Contributor

@flipace flipace commented Jul 6, 2023

Issue

🐞 When serving an app with vite under a subdirectory (ie http://localhost/admin/) and using the unocss devtools feature, it would send the devtool requests to http://localhost/. This led to a 404 as the POST_PATH which unocss checks for is hardcoded as /@unocss-devtools-update and does not take into account a subpath (/admin/@unocss-devtools-update !== /@unocss-devtools-update)

Fix

💅 Prepending the POST_PATH with the base option from the vite config allows the devtools to send and receive the request to/on the proper path.

@flipace flipace requested a review from antfu as a code owner July 6, 2023 07:12
@netlify
Copy link

netlify bot commented Jul 6, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e333094
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/64a66b634a065e00083d39e7
😎 Deploy Preview https://deploy-preview-2836--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

When serving an app with vite under a subdirectory, the `POST_PATH` for devtools also has to include the subdirectory when checking the request urls.
@zyyv zyyv changed the title fix(@unocss/vite) prepend base on devtools POST_PATH fix(vite): prepend base on devtools POST_PATH Jul 7, 2023
@antfu antfu merged commit 95f9c93 into unocss:main Jul 8, 2023
10 checks passed
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.

None yet

2 participants