Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hunghg255/vite-host-qrcode

Run Vite host with qrcode
https://github.com/hunghg255/vite-host-qrcode

host npm plugins qrcode vite

Last synced: about 2 months ago
JSON representation

Run Vite host with qrcode

Awesome Lists containing this project

README

        



logo


A plugin print text, QR code for Vitejs


NPM Version
NPM Downloads
Minizip
Contributors
License

## Install

```bash
npm i vite-host-qrcode -D
```

```bash
# package.json
"scripts": {
"dev": "vite --host",
...
},
```

Vite

```ts
// vite.config.ts
import HostQrCode from 'vite-host-qrcode/vite'

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

Example: [`playground/`](./playground/)


CLI output

## Options
```ts
type Message = string | MessageValue | ((kolorist: Kolorist) => string | MessageValue | Promise)

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:

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

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