meteor/meteor

Vite config is parsed incorrectly

redabourial opened this issue · 2 comments

Hi,
I have an issue when meteor misinterprets the true flag in server.host in vite.config.js :

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [vue()],
  server: {
    hmr: {
      host: 'localhost',
      clientPort: 80
    },
    host: true,
    proxy: {
      '^/(?!imports|@vite|packages).*': {
        target: "http://meteor:3000",
        changeOrigin: true,
        secure: false,
      },
    },
  },
  meteor: {
    clientEntry: 'imports/ui/main.js',
  },
  optimizeDeps: {
    exclude: ['vue-meteor-tracker'],
  },
})

Screenshot from 2024-02-10 10-48-51
The webpage fails to loads as it is placing requests to http://true:5173

i'm using a nginx reverse proxy in dev and staging and need to have a single port for communicating with both meteor and vite.
does anyone have a workaround for this issue ?

Thanks in advance,
Cheers,

Having the same issue within the vscode Devcontainer, this is about making Dev accessible on the local network.
Now have the following workaround:
I enter a FQDN as the host, which I redirect to 127.0.0.1 in the docker container via /etc/hosts and on the local network via DNS to the corresponding IP.

vite.config.js

export default defineConfig({
  server: {
    host: "wolftrack.lan",
  },

devcontainer.json

{
	[...]

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	"forwardPorts": [3000,3001,5173],

	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "echo '127.0.0.1 wolftrack.lan' | sudo tee -a /etc/hosts"
}

And on my PiHole, I have set a local DNS Record for:
wolftrack.lan 10.10.96.40

I hope this helps somehow

This should be fixed with jorgenvatle:vite-bundler@1.12.12 and meteor-vite@1.10.2.

If you're on Meteor v3, use jorgenvatle:vite-bundler@2.0.0-beta.14 instead. 👍