vite-plugin-switch-hosts
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

vite-plugin-switch-hosts

switch hosts by service worker for each origin in browser without modify system hosts file

feature

  • switch hosts
  • different origin can use different hosts simultaneously
  • without modify system hosts file

limitation

  • current origin must support service worker. in other words, location.hostname is localhost or match 127.x.y.z, or location.protocol must be https:

  • target domain must use http or https, websocket is not supported

  • redirect url will follow in proxy dev server, not found a better solution yet

install

pnpm add -D vite-plugin-switch-hosts

config

SwitchHostsOption

export interface SwitchHostsOption {
  /**
   * host -> another_host
   */
  dns?: Record<string, string>;
}

example

see test/example/vite.config.ts

Package Sidebar

Install

npm i vite-plugin-switch-hosts

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

171 kB

Total Files

19

Last publish

Collaborators

  • lisonge