arnoson / kirby-vite

Use Kirby CMS together with Vite
MIT License
81 stars 7 forks source link

Deployed build references localhost? #2

Closed alancwoo closed 3 years ago

alancwoo commented 3 years ago

I’ve built for production with ‘npm run build’ but noticed the deployed site is referencing localhost for the js and css assets. It works locally but am wondering if I am missing some amount of configuration or how to best go about debugging this?

eg, footer.php

<?= vite()->js() ?> results in <script src="http://localhost:3000/index.js" type="module"></script> instead of the built files.

alancwoo commented 3 years ago

Ah ok, so it looks like it has to do with https://github.com/arnoson/kirby-vite/blob/fcf9a6199a5c6d32f6940a6267dd1274394b546a/lib/Vite.php#L68

So it looks like I had perhaps run the dev server which created the lockfile and didn't build/remove it before rsyncing.

Removing /src/.lock on the remove server fixed the issue.

arnoson commented 3 years ago

I was just writing a reply, happy to hear that everything works now!

arnoson commented 3 years ago

You could also add an separate config for the remote server in which you set arnoson.kirby-vite.dev to false. Setting this option will always have priority over the .lock file check.

alancwoo commented 3 years ago

Ah right, that makes a lot more sense (to use the config), thanks for the response and the great plugin :)