Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin hook for when vite opens the browser #18596

Open
4 tasks done
rtabulov opened this issue Nov 6, 2024 · 0 comments
Open
4 tasks done

plugin hook for when vite opens the browser #18596

rtabulov opened this issue Nov 6, 2024 · 0 comments

Comments

@rtabulov
Copy link

rtabulov commented Nov 6, 2024

Description

it would be nice if you added a new hook for when vite opens the browser.

in our team we have a 'mirror-plugin' in one of our projects which mirrors the same app on another port, so that we have additional ports when using vite dev command, we use it something like this

    plugins: [
        react(),
        mirrorPlugin(3021),
        mirrorPlugin(3022),
    ],

we wanted to also open these ports (url) in browser when vite opens the browser
the problem is we open the urls on configureServer hook at server.httpServer.on('listening', ...) after checking server.config.server.open, but this does not really reflect when the browser is actually opened by vite.

it would be nice to have a hook for when vite opens the browser for a plugin like ours.

Suggested solution

add a vite plugin hook for when vite opens the browser, something like browserOpened

Alternative

No response

Additional context

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant