JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3276
  • Score
    100M100P100Q117693F
  • License MIT

open browser when webpack loads

Package Exports

  • webpack-open-browser
  • webpack-open-browser/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-open-browser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

webpack-open-browser

npm npm Known Vulnerabilities Percentage of issues still open PRs Welcome

open browser when webpack loads

πŸ“¦ Installation

# npm
npm install webpack-open-browser -D
# yarn
yarn add webpack-open-browser -D

πŸ”§ Configuration

You can read the source or test code for more details. The open browser ability is provided by package open. You can check it for some option details, for example browser option.

Check this issue #25 for incognito mode。

const { WebpackOpenBrowser, apps } = require('webpack-open-browser');

const commonConfig = {
  plugins: [
    // open http://localhost:3000 in default browser
    new WebpackOpenBrowser({ url: 'http://localhost:3000' }),

    // specify firefox to open
    new WebpackOpenBrowser({ url: 'http://localhost:3000', browser: apps.firefox }),

    // the browser argument is platform dependent
    // For Windows chrome
    new WebpackOpenBrowser({ url: 'http://localhost:3000', browser: 'chrome' }),
    // For MacOS chrome, the basename of /Applications/Google Chrome.app
    new WebpackOpenBrowser({ url: 'http://localhost:3000', browser: 'Google Chrome' }),
    // For developer version firefox on MacOS
    new WebpackOpenBrowser({ url: 'http://localhost:3000', browser: 'Firefox Developer Edition' }),
    // You can use builtin apps object to create cross-platform browser name
    // support apps.chrome, apps.firefox, apps.edge
    new WebpackOpenBrowser({ url: 'http://localhost:3000', browser: apps.chrome }),

    // delay 3 seconds
    new WebpackOpenBrowser({ url: 'http://localhost:3000', delay: 3 * 1000 }),

    // By default, this plugin only works when no compile error
    new WebpackOpenBrowser({ url: 'http://localhost:3000', ignoreErrors: true }),

    // You can set a group of option to open multiple urls in multiple browsers
    new WebpackOpenBrowser([
      { url: 'http://localhost:3000', browser: apps.chrome },
      { url: 'http://localhost:3000', browser: apps.firefox },
    ]),

    // pass arguments
    new WebpackOpenBrowser({
      url: 'https://github.com/',
      browser: apps.chrome,
      arguments: ['--incognito'],
    }),
  ],
};