You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vite-plugin-http-basic-auth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-http-basic-auth

A Vite plugin adding HTTP Basic Auth support

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
67
-12.99%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-http-basic-auth

  • HTTP basic auth for vite server

Install

npm i -D vite-plugin-http-basic-auth

Example usage

import { defineConfig, loadEnv } from 'vite'
import httpAuth from 'vite-plugin-http-basic-auth'

// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
  const env = loadEnv(mode, process.cwd(), '')

  return ({
    plugins: [
        httpAuth([{
          username: env.VITE_AUTH_USERNAME_1,
          password: env.VITE_AUTH_PASSWORD_1
        },{
          username: env.VITE_AUTH_USERNAME_2,
          password: env.VITE_AUTH_PASSWORD_2
        }], {
            realm: env.VITE_AUTH_REALM,
            useInServer: true,   // True by default
            useInPreview: true,  // True by default
        })
    ]
  })
})

Keywords

vite-plugin

FAQs

Package last updated on 06 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts