Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rollup-watch

rollup119.1kMITdeprecated4.3.1

rollup-watch functionality is now included in Rollup itself

Watch files for changes and perform incremental rebuilds with Rollup

rollup, modules, bundling

readme

rollup-watch

This module is used by the Rollup command line interface to enable automatic incremental rebuilds.

Install it to your project like so...

npm install --save-dev rollup-watch

...then invoke it by adding the --watch flag (or -w) to the command that starts Rollup. In this example, npm run dev will create your bundle then recreate it whenever its sources change:

// package.json
{
  // ...
  "scripts": {
    "build": "rollup -c",
    "dev": "rollup -c -w"
  }
}

Options

You can specify watch options in your rollup.config.js file:

// rollup.config.js
export default {
  entry: 'src/main.js',
  ...,
  watch: {
    chokidar: {
      // if the chokidar option is given, rollup-watch will
      // use it instead of fs.watch. You will need to install
      // chokidar separately.
      //
      // this options object is passed to chokidar. if you
      // don't have any options, just pass `chokidar: true`
    },

    // include and exclude govern which files to watch. by
    // default, all dependencies will be watched
    exclude: ['node_modules/**']
  }
};

LICENSE

MIT

changelog

rollup-watch changelog

4.3.1

  • Clean up listeners on close

4.3.0

  • Stop watching when process is killed (#30)

4.2.0

  • Support include and exclude options (#22)

4.1.0

  • Rename options.watch.useChokidar to options.watch.chokidar (#52)
  • Allow passing chokidar options via options.watch.chokidar (i.e. can be true or {...}) (#52)

4.0.0

  • On error, watch files from last successful build (#38)
  • Fix bug preventing chokidar from ever working (#45)
  • Add options.watch.useChokidar option

3.2.2

  • Fix missing require-relative (#41)
  • Prevent infinite build loops

3.2.1

  • Published mistakenly

3.2.0

  • options.targets, not options.target (#36)
  • Use chokidar if available (#39)

3.1.0

  • Add watcher.close() method
  • Resolve symlinks before watching (#32)

3.0.0

  • Don't check for version updates (#12, #26, #34)
  • Fix initial flag (#13)
  • Retain options object (#24)
  • Don't watch generated bundle (#15)

2.5.0

  • Use cache (#8)

2.4.0

  • Only watch files that exist (disregard plugin helper modules) (#3)

2.3.0

  • Handle rename events (#4)

2.2.0

  • Emit errors and recover (#2)

2.1.1

  • Fix pkg.files

2.1.0

  • Experiment with using native fs.watch

2.0.0

  • CLI must pass rollup to watch
  • Check version is current before starting
  • Return an EventEmitter

1.0.0

  • First experimental release