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

Update working-with-vite-in-ddev.md #237

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dingman
Copy link

@dingman dingman commented Aug 6, 2024

Added language to start vite as a daemon

The Issue

How This PR Solves The Issue

Manual Testing Instructions

Automated Testing Overview

Related Issue Link(s)

Release/Deployment Notes

@rfay
Copy link
Member

rfay commented Aug 6, 2024

@mandrasch thanks for the article, and your review is what matters, thanks.

@mandrasch
Copy link
Contributor

mandrasch commented Aug 7, 2024

Hi @dingman, thanks for suggestion and PR! 👍

Please implement the following changes:

  1. Web Daemons are not specific to Laravel, please add a new headline and section before the section "NodeJS"
  2. Please add a disclaimer that Vite devserver output is not visible directly in case of errors and that they need to be accessed via ddev logs.
  3. Please link to this article as practical example https://www.viget.com/articles/how-we-use-ddev-vite-and-tailwind-with-craft-cms/

Reasoning, why I'm not a fan of this, at least for a beginner's tutorial - because web daemons can make things harder for newbies, quote from discussion on Discord:

We've had similar discussions / preferences around web_extra_daemons at Viget.

Some of us like having it run in a background daemon, others like putting it in the post-start hook. That way it runs automatically, but the output & errors are still visible in the terminal.

web_extra_daemons does bury things a bit, which can trip up folks who don't know about ddev logs.

Once a project is somewhat stable, there usually isn't too much trouble running in a daemon.

From my point of view it is an expert topic. With a disclaimer and in a extra section, this is fine in my opinion - and a great addition to the article. 👍

@rfay I have no real time resources till end of month (summer time 🌞 ), feel free to merge this in any way it seems fitting to you. The article should be helpful for the whole DDEV community and not just be my personal opinion piece (of course). ;) I could re-check at end of August as well to see if I have further change proposals.

@rfay
Copy link
Member

rfay commented Sep 1, 2024

Looking forward to getting back to this when you've had a chance to look at the suggestions @dingman and when you get back @mandrasch

@mandrasch
Copy link
Contributor

mandrasch commented Sep 5, 2024

@dingman What about something like this? (new chapter in the article)

Automatically start Vite

There is also the possibility to automatically start Vite when you start a DDEV project.

Please beware: Autostart can complicate things a bit, it's a technique for advanced usage.

Some developers like having it run in a background daemon, others like putting it in the post-start hook. That way it runs automatically, but the output & errors are still visible in the terminal.

If you want to run Vite in the background as a daemon via web_extra_daemons, edit your config.yaml like this ("ddev restart" needed):

web_extra_daemons:
  - name: vite
    command: bash -c 'npm install && npm run dev -- --host'
    directory: /var/www/html

Errors are only visible via "ddev logs" if you run Vite as daemon.

An example can be found here as well: https://github.com/ddev/ddev.com You can also use supervisors like pm2 (https://www.lullabot.com/articles/nodejs-development-ddev)

@dingman
Copy link
Author

dingman commented Sep 5, 2024

Sadly, I haven't had time to prioritize making this update.

Your update looks great and I give it a +1

@rfay
Copy link
Member

rfay commented Oct 1, 2024

You'd probably want to update and push the change @dingman

I'll close this about November 1, 2024 if it doesn't make progress. Thanks for taking the time to contribute on this, but we need to get to the finish line.

Added language to start vite as a daemon
@rfay
Copy link
Member

rfay commented Oct 1, 2024

Rebased.

@mandrasch
Copy link
Contributor

hey, I'll bring it over the finish line 🏁 thanks for reminder!

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

Successfully merging this pull request may close these issues.

3 participants