vite v5 https setting

less than 1 minute read

Starting with Vite v5, the setting for HTTPS option has changed.

No more https: true!

See the vite.config.ts file below.

import { createServer } from 'https';
{
    // ...
    https: createServer() // this is it
    // ...
}

All vite.config.ts file is below.

// vite.config.ts
import { defineConfig } from 'vite';

import basicSsl from '@vitejs/plugin-basic-ssl';
import { createServer } from 'https';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  
  return {
    plugins: [
      basicSsl({
        /** setting for vite-plugin-basic-ssl
        https://github.com/vitejs/vite-plugin-basic-ssl
         */
      }),
    ],
    server: {
      https: createServer(), // No more boolean. Let's create server!
    },
  };
});

20240208

Tags:

Categories:

Updated:

Leave a comment