statamic / ssg

The official Statamic Static Site Generator
232 stars 24 forks source link

After generating asset links have [::1]:5173 for their domain #157

Closed xillonz closed 6 months ago

xillonz commented 9 months ago

APP_ENV is set to production, however after running php please ssg:generate the generated index.html has links such as:

http://[::1]:5173/resources/css/site.css

http://[::1]:5173/resources/js/site.js

This obviously breaks the website as no CSS or JS is accessible.

duncanmcclean commented 6 months ago

With Vite, when you run npm run dev, it starts a local web server and creates a "hot file" which Laravel uses to determine if it should point at the local Vite web server or at the built CSS & JS files in public/build.

I presume what's happening here is that you have npm run dev running at the same time as the ssg:generate command and because that hot file exists, Laravel is pointing to Vite's server.

If you run npm run build, then try running the ssg:generate command, the CSS & JS should be pointing to the right place. If that's not the case, feel free to leave a comment and we can re-open this issue. Thanks!