I'm working off of a remote server through remote ssh. I can run npm run dev to see localhost3000 and everything works fine, but when I npm run build the paths are messed up. I do have to manually navigate to my dist folder in the browser to display it (www.example.com/dist) and I noticed when I inspect the paths are set to / in a style link (<link href="/_astro.css>). If I go back a level ( <link href="../_astro.css">) the css works. Is there a way to fix this issue? Thanks in advance..
#assets and CSS paths don't work on build.
1 messages · Page 1 of 1 (latest)
I think I have the same problem. I used GitHub to Cloudflare to deploy everything last night and everything worked fine on the dev server but at build, non of my CSS and images showed up. Well scratch that, two of them did and they are in the same directory. The CSS I moved to the src folder and it worked but there are definite issues. My posts set as draft showed up too. For the pictures if there is no fix, I will have to use a cdn. The posts I will have to use JS to make sure they don’t get pulled. But a fix would be nice.
Are you viewing your build using the ‘astro preview’ command?
It lets you preview the output from astro build, you can do ‘pnpm build’ then ‘pnpm preview’ and it will launch a locally hosted server for you to view your build files
Oh!! I didn't know that.. how do I point the host domain to that preview mode?
The preview command is only for development so you can view your finished website before you deploy it, it is not meant to host your server
Thank you