Closed bdfpplinsinga closed 2 months ago
Hey, the Vite dev server runs at localhost:3000 when running npm run dev
, but you wouldn't use it to preview the site. The WordPress theme in development mode pulls in assets served from localhost:3000. I use local URLs like mysite.test.
You can see how those assets are used when in development mode: https://github.com/cearls/timberland/blob/main/theme/functions.php#L102-L108
Hee Chris,
Indeed on the front end all is working, but i cant seem to get the backend working. I tried to add these vite script links to the admin_head with
add_action('admin_head', 'vite_head_module_hook');
but this doesnt seem to work. The only thing that works is running a build command. Am i missing something? Or aren't you using the vissual backend on development?
I have been running npm run build
to preview in the admin. I typically develop templates on the frontend and the backend comes later as I split the templates into reusable blocks.
Let me give this some thought as I can see how it would be annoying since that's how the theme used to work prior to Vite.
In my setup this doesn't seem to work. Maybe this has anything to do with the fact that I'm using 'normal' urls instead of localhost. So by default it's opening localhost:3000 when running npm run dev. But this gives back a dns error.
Originally posted by @bdfpplinsinga in https://github.com/cearls/timberland/issues/39#issuecomment-2097097177