arnoson / kirby-vite

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

Gracefully handle `host: true` #20

Closed renestalder closed 1 year ago

renestalder commented 1 year ago

I hesitated for a long time to update from version 1 to version 2 because it never worked out of the box. Now I finally found out why.

So, I'm using the following config in my Vite config to make my projects work inside Docker containers:

{
    server: {
        cors: true,
        host: true
        port: 3000,
        strictPort: true,
    },
}

The host: true is crucial and a valid value in Vite.

Now, since the kirby-vite plugin uses host to write down the server address to the .dev, the server address always landed as http://true:3000 in the .dev file.

That wasn't an issue in previous versions, as the mechanism wasn't the same.

To solve, I had to switch to host: "0.0.0.0".

I wondered if you could handle host: true automatically and set it to 0.0.0.0 in the .dev file.

arnoson commented 1 year ago

Thanks for pointing this out! Should be fixed in vite-plugin-kirby@0.2.1