vite-host-qrcode
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

vite-host-qrcode

NPM version

Install

npm i vite-host-qrcode -D
# package.json
"scripts": {
  "dev": "vite --host",
  ...
},
Vite
// vite.config.ts
import HostQrCode from 'vite-host-qrcode/vite'

export default defineConfig({
  plugins: [
    HostQrCode({ /* options */ }),
  ],
})

Example: playground/


CLI output

Options

type Message = string | MessageValue | ((kolorist: Kolorist) => string | MessageValue | Promise<string | MessageValue | void>)

export interface Options {
	info?: Message[]
  /**
	 * filter list of shown QR codes. Useful if you have multiple interfaces and only need one
	 *
	 *  examples:
	 *    url => url.startsWith('http://192.')
	 *    url => !url.startsWith('http://172.)
	 *    url => url === 'http://192.168.1.70:4173'
	 *
	 * @param url {string} ip address
	 * @returns {boolean}
	 */
  filter?: (url: string) => boolean
}

filter

A function that allows you to select addresses to show QR-Codes for in case you have multiple interfaces

Example:

// vite.config.js
import HostQrCode from 'vite-host-qrcode/vite'

export default defineConfig({
	plugins: [HostQrCode({ filter: (url) => url === 'http://192.168.1.1:4173' })]
});

Package Sidebar

Install

npm i vite-host-qrcode

Weekly Downloads

4

Version

0.0.5

License

MIT

Unpacked Size

18.6 kB

Total Files

16

Last publish

Collaborators

  • hunghg255