Skip to content

Allow options in open to be passed to server.open (e.g. server.open.arguments) #9572

@mesqueeb

Description

@mesqueeb

Description

Currently, as per the vite types, server.open can only accept boolean | string

open?: boolean | string

Further more, the Vite docs say:

server.open
See the open package for more details.

When checking the Open docs, for best cross-platform support, they suggest to set the browser like so:

const open = require('open');

await open('https://google.com', {
	app: {
		name: open.apps.chrome
	}
});

Ref: https://github.com/sindresorhus/open#openapps

However, trying to use open.apps.chrome in Vite like so, gives a type error:

server: { open: open.apps.chrome }

image

Suggested solution

We need to be able to set Chrome but make sure it works for both Windows and MacOS.

My suggestion is to allow readonly string[] which is returned by open.apps.chrome so that we can use this option in the Vite config.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-to-be-discussedEnhancement under consideration (priority)

    Type

    No type

    Projects

    Status

    Has plan

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions