arnoson / kirby-vite

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

Use server origin instead of symlink for assets? #8

Closed LeBenLeBen closed 2 years ago

LeBenLeBen commented 2 years ago

The documentation state that a symlink must be created so the web server can access assets, but this solution has a few issues for me:

I think I was able to achieve the same result without the drawbacks above by using Vite server.origin option instead like stated in the Backend Integration docs:

export default defineConfig(({ mode }) => ({
  // ...
  server: {
    // ...
    origin: 'http://localhost:3000',
  }
  // ...
}));

This ensure that assets URL are prefixed with Vite dev server host so they load properly.

Do you see any issue with this approach I would have overlooked? Would you like me to submit a PR to replace the symlink?

arnoson commented 2 years ago

Thank you for mentioning this! I also had some problems with the symlinks. I will test your suggestion and let you know If I find any problems with it

arnoson commented 2 years ago

Just had some time to test it and it seems to work great. I had a request for this, didn't know that this is finally possible! Would be happy if you submit a PR!