question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow server.open to be passed `readonly string[]` as per `open` spec

See original GitHub issue

Description

Currently, as per the vite types, server.open can only accept boolean | stringhttps://github.com/vitejs/vite/blob/26bcdc3186807bb6f3817119cd7e64ae8308a057/packages/vite/src/node/http.ts#L37

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bluwycommented, Aug 19, 2022

Thanks @sapphi-red for the find! I think it’s nice if we can upstream the changes, we would probably have to have it as a normal dependency then, and re-export the app variable. But also, looks like Sindre prefers no to use an applescript: https://github.com/sindresorhus/open/issues/256#issuecomment-868984143

1reaction
sapphi-redcommented, Aug 19, 2022

@bluwy

I’m not sure what’s the reason of this mismatch though.

This is to reuse the existing tab. By using AppleScript, we can reuse it on macOS+Chromium base browsers. (It does not work with other OS/browers though…) open will open a new tab everytime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Configure Read-Only Routing for an Availability Group ...
In this article we will try to explain how to configure read-only routing for an Availability Group in SQL Server 2016 and how...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
The OpenAPI Specification defines a standard interface to RESTful APIs which allows both humans and computers to understand service capabilities without ...
Read more >
OpenAPI Specification v3.0.3 | Introduction, Definitions, & More
The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model ...
Read more >
Connect to an availability group listener - SQL Server Always On
While availability group listeners enable support for failover redirection and read-only routing, client connections are not required to use ...
Read more >
MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables
When bind_address names a list of multiple values, the server listens on one socket per value, with each socket bound to a single...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found