Very simple utility function that opens the browser, with some smartness built in:
- It uses the
BROWSERenvironment variable to determine what browser to open.
BROWSERcan be set to a script file name ending in
.jsto call that script with the URL instead of opening the browser.
- When using Google Chrome on Mac and a tab with the same URL is already open, it will focus and reload that tab instead of opening a new tab.
npm i @includable/open-browser
const openBrowser = require('@includable/open-browser') openBrowser('https://www.includable.com/')