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

feat: Add support for vite serve #6765

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: Add support for vite serve #6765

wants to merge 2 commits into from

Conversation

mejo-
Copy link
Member

@mejo- mejo- commented Dec 10, 2024

Fixes: #6732

🚧 TODO

  • Add support for a nginx config drop-in to nextcloud-docker-dev

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Documentation (README or documentation) has been updated or is not required

@max-nextcloud
Copy link
Collaborator

Thanks a lot for looking into this. ❤️ I'm super happy this works.

I have two suggestions:

  • use a non-standart port and add it to the vite config. Then we can hardcode the same port in nextcloud-docker-dev for text. I suggest 7347 😉.
  • I will look into making use of vite/@client instead of the middleware. It looks like that rewrites the module urls inside the browser and could replace the middleware. See step 2 of https://v5.vite.dev/guide/backend-integration.html

@max-nextcloud
Copy link
Collaborator

max-nextcloud commented Dec 11, 2024

I tried to follow the instructions.
It proved a bit challenging to get the changes to nginx applied. Whenever i restarted the proxy container my changes were gone. So I tried to add the locations and then ran /etc/init.d/nginx restart. This printed some errors about not being able to bind but then at least my config would have an effect.

However now I am seeing this in the proxy logs:

proxy-1      | nginx.1     | 2024/12/11 09:34:19 [error] 63#63: *9 connect() failed (101: Network is unreachable) while connecting to upstream, client: 192.168.23.1, server: nextcloud.local, request: "GET /apps/text/js/text-init.mjs HTTP/1.1", upstream: "http://192.168.15.1:5173/apps/text/js/text-init.mjs", host: "nextcloud.local"

Maybe the ip addresses are different for me?

Update ahh... reading helps

Replace '192.168.15.1' with the IP of your docker host.

@mejo-
Copy link
Member Author

mejo- commented Dec 11, 2024

Thanks for testing it out @max-nextcloud. I added support for a nginx config drop-in to nextcloud-docker-dev in the meantime: juliusknorr/nextcloud-docker-dev#367

This approach is also the reason why I'd keep the default port of vite serve: we won't add the configuration for forwarding Text request to vite serve to nextcloud-docker-dev anyway. But in future it's as simple as running npm run serve in Text repo and adding the small snippet to data/nginx/vhost.d/nextcloud.local in nextcloud-docker-dev and that's it.

Maybe the ip addresses are different for me?

Yes, that's adjusted now as well. The PR to nextcloud-docker-dev adds host.docker.internal to the proxy container, so no longer needed to fiddle around with IPs.

Fixes: #6732

Signed-off-by: Jonas <jonas@freesources.org>
Use the same filename for source file and compiled asset.

Signed-off-by: Jonas <jonas@freesources.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🧭 Planning evaluation (don't pick)
Development

Successfully merging this pull request may close these issues.

Build performance with vite
2 participants