0.0.5 • Published 10 months ago
vite-host-qrcode v0.0.5
vite-host-qrcode
Install
npm i vite-host-qrcode -D
# package.json
"scripts": {
"dev": "vite --host",
...
},
// vite.config.ts
import HostQrCode from 'vite-host-qrcode/vite'
export default defineConfig({
plugins: [
HostQrCode({ /* options */ }),
],
})
Example: playground/
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' })]
});