vite-plugin-http-basic-auth
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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
        })
    ]
  })
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    40
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    40
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i vite-plugin-http-basic-auth

Weekly Downloads

40

Version

1.0.2

License

MIT

Unpacked Size

5.5 kB

Total Files

5

Last publish

Collaborators

  • gamecraftcz