martinszeltins's avatar

Vue.js Vite has an option for https, but I'm getting invalid config

Hi, in the Docs for Vite it says this

Starting the server with --https will automatically generate a self-signed cert and start the server with TLS and HTTP/2 enabled.

But when I tried it it shows me invalid config. Am I doing it wrong?

$ npm run dev --https
npm WARN invalid config https-proxy=true
npm WARN invalid config Must be a full url with 'http://'

> [email protected] dev C:\xampp\htdocs\vue-client-laravel-server\client
> vite

vite v1.0.0-rc.4

  Dev server running at:
  > Network:  http://192.168.1.118:3000/
  > Local:    http://localhost:3000/
0 likes
5 replies
Sinnbeck's avatar

It sounds like you have an error in your config file. How about posting it?

martinszeltins's avatar

@sinnbeck There is no config file, I just followed the instructions in the docs

$ npm init vite-app <project-name>
$ cd <project-name>
$ npm install
$ npm run dev

The above works without problems.

But this doesn't work..

$ npm run dev --https
Sinnbeck's avatar

I am getting the exact same error. It seems to happen when using npm run dev

You can get around it by running vite directly

npx vite --https
martinszeltins's avatar

@sinnbeck yes, also I learned that in order to pass arguments to vite when running npm run you need to do it like this...

npm run dev -- --https

–https is the vite option. In npm command first -- means after this is an argument --https, and it executed like vite --https

Please or to participate in this conversation.