vite-plugin-https
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

VITE_PLUGIN_HTTPS

Utilizes devcert to provide HTTPS service.

Usage

import pluginHttps from "vite-plugins-https";

export default defineConfig({
  plugins: [httpsPlugin()],
});

Vite Middleware Mode

When you use the middleware mode in Vite, this plugin will not take effect because you need to manually pass the HTTPS options to your custom server.

import { certificateFor } from '@childrentime/devcert'

const app = express();
const viteServer = await createViteServer({
  // ...options,
  server: { middlewareMode: true },
  appType: "custom",
});
app.use(viteServer.middlewares);

// instead of
const server = app.listen(port, () => {});

// use
const localHttpsOptions = await certificateFor(["localhost"]);
const server = https.createServer(localHttpsOptions, app);
server.listen(port, () => {});

Package Sidebar

Install

npm i vite-plugin-https

Weekly Downloads

2

Version

1.0.2

License

UNLICENSED

Unpacked Size

6.15 kB

Total Files

8

Last publish

Collaborators

  • lianwenwu