0.0.2 • Published 2 years ago

vite-plugin-server-callback v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vite-plugin-server-callback

It is a plugin to get exact listened port on vite.

Install

npm install vite-plugin-server-callback -D

yarn add vite-plugin-server-callback -D

Usage

import { defineConfig } from 'vite';
import serverPlugin from 'vite-plugin-server-callback'

export default defineConfig({
  ...,
  plugins:[
    serverPlugin({
      onReady: (port: number) => {
        console.log("onReady", port)
      }
    })
  ]
})

onError

emit error on http server

import { defineConfig } from 'vite';
import serverPlugin from 'vite-plugin-server-callback'

export default defineConfig({
  ...,
  plugins:[
    serverPlugin({
      onError: (err: Error) => {
        console.error("err", err)
      }
    })
  ]
})

onClose

//