nodemon-browsersync-webpack-plugin

1.0.1 • Public • Published

Nodemon Browsersync Webpack Plugin

A webpack plugin that starts and reloads Nodemon and Browsersync. It is useful when developing web applications that leverage both server-side rendered HTML pages and webpack bundles.

Initially based on Va1/browser-sync-webpack-plugin

Installation

Install the plugin with npm:

$ npm install nodemon-browsersync-webpack-plugin --save-dev

Usage

$ webpack --watch

Basic

Pass Nodemon options and BrowserSync options into the plugin in that order.

const NodemonBrowsersyncPlugin = require('nodemon-browsersync-webpack-plugin');
 
module.exports = {
  entry: './src/js/entry.js',
  output: {
    path: './public/assets',
    filename: 'bundle.js'
  },
  plugins: [
    new NodemonBrowsersyncPlugin({
      script: 'server.js',
      ignore: [
          "src/*", 
          "public/*"
      ],
      ext: 'js json',
      verbose: true
    }, {
      proxy: 'localhost:8001'
    )
  ]
};

In the example above, Browsersync will wrap your vhost with a proxy URL to view your site.

NOTE: For reusabilty, a nodemon.json configuration file is recommended rather than embedding Nodemon options in the plugin. Checkout the sample nodemon.json for further details.

Contributing

Feel free to open issues to propose stuff and participate. Pull requests are also welcome.

License

MIT

Package Sidebar

Install

npm i nodemon-browsersync-webpack-plugin

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • gurunate