rollup / rollup-watch

Fast incremental rebuilds with Rollup CLI
MIT License
91 stars 23 forks source link

Do not watch node_modules/** #22

Closed lkmill closed 7 years ago

lkmill commented 8 years ago

It feels silly to be watching all files imported from node_modules as they are unlikely to change in normal environments. Would it not be reasonable to skip those by default, and instead allow passing an option to watch them?

Rich-Harris commented 7 years ago

I think the best way to approach this would be to specify watch options in the main config object, two of which could be include and exclude (same as with plugins):

// rollup.config.js
export default {
  entry: 'src/index.js',
  dest: 'bundle.js',
  format: 'iife',
  watch: {
    exclude: 'node_modules/**'
  }
};

A lot of times I do want to watch my node_modules, because I'm often using npm link. Since not rebuilding when npm dependencies change would be unexpected behaviour, I don't think it should be the default, but I get why it would be useful as an option.

lkmill commented 7 years ago

That sounds fair enough, and definitely solves my problems!

matthiasg commented 7 years ago

This is also needed when for example pre-compiling (e.g typescript etc) to js is required

Rich-Harris commented 7 years ago

Released 4.2.0 with this. Details on the PR: https://github.com/rollup/rollup-watch/pull/56