@open-xchange/vite-plugin-print-urls
v1.5.0
Published
Vite plugin to print additional URLs when starting dev/preview server
Maintainers
Keywords
Readme
@open-xchange/vite-plugin-print-urls
A Vite plugin that allows printing additional URLs to the console when starting the dev or preview server.
The URLs are printed through vite's own logger, so they respect the configured logLevel just like vite's own Local/Network output (e.g. they are suppressed by logLevel: 'silent').
Usage
Add the plugin to your Vite configuration:
// vite.config.ts
import { defineConfig } from 'vite' // or 'vitest/config'
import printUrlsPlugin from '@open-xchange/vite-plugin-print-urls'
export default defineConfig(() => {
// ...
plugins: [
// ...
printUrlsPlugin({
urls: {
Server: env.SERVER,
},
}),
],
})results in an additional line 'Server' when starting the Vite dev server (or the Vite preview server):
> vite dev
VITE v5.3.5 ready in 693 ms
➜ Server: https://your.dev.server
➜ Local: https://localhost:3000/
➜ Network: use --host to expose
➜ press h + enter to show helpOptions
| Name | Type | Default | Description |
| - | - | - | - |
| urls | Record<string, string\|undefined> | required | A map with the labels as keys ('Server' in the example above), and the values to be printed after the labels. Empty strings and undefined values will be omitted. |
