Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't detect new files? #56

Open
chrisabrams opened this issue May 20, 2014 · 9 comments · May be fixed by #297
Open

Doesn't detect new files? #56

chrisabrams opened this issue May 20, 2014 · 9 comments · May be fixed by #297

Comments

@chrisabrams
Copy link

Is there a configuration needed to get watchify to recognize new files?

@ghost
Copy link

ghost commented May 20, 2014

How do you mean new files? Like from a glob? If you require() new files in your existing code they will get included and watched. Unless perhaps there is a bug.

@aearly
Copy link

aearly commented Jun 19, 2014

Here's a use case that fails for me, that might be what @chrisabrams is describing:

watchify test/*.test.js -o public/js/tests.js -v

This will build the current set of test files. If you touch test/foo.test.js to create a new spec file, it won't be picked up.

This is understandable, since the widcard is expanded by the shell before it is passed to watchify. Likewise, if you were using grunt-browserify with watch: true, it would also expand the wildcard before handing the list of files to watchify.

chokidar would have to support watching wildcards/globs, and watchify would need a special argument to pass a wildcard to be dynamically evaluated, rather than a list of files. Watching an arbitrary glob pattern for files that may not exist yet does not seem like something easy to accomplish, at least at first glance....

In the meantime, I just restart watchify when I add a new entry point.

@chrisabrams
Copy link
Author

@aearly that's what I have to end up doing as well..but I want it to pick it up for me :)

@aearly
Copy link

aearly commented Jun 26, 2014

I just came across fireworm which can watch globs patterns for new files (as well as the other standard fs.watch events). It needs a basedir to start from, however.

@simonzack
Copy link

+1, most of the gulp incremental build packages offer this.

@simonzack
Copy link

@aearly watchify uses chokidar which does support added files & globs (perhaps it did not when you commented?).

@aearly
Copy link

aearly commented Feb 11, 2015

@simonzack the issue is glob expansion before the list of files is handed to watchify.

watchify test/*.test.js -o public/js/tests.js

gets expanded to:

watchify test/foo.test.js test/bar.test.js test/baz.test.js -o public/js/tests.js

and then executed.

There is no way for watchify to know that test/qux.test.js has been added because it has no knowledge of the glob -- as far as it knows, you passed in a list of files.

@simonzack
Copy link

watchify 'test/*.test.js' -o public/js/tests.js could be used instead. I'm switching to gulp-watch, niether has caching so there's no difference in my case.

@aearly
Copy link

aearly commented Feb 11, 2015

Yep, or probably something like watchify --entry-glob 'test/*.test.js' -o public/js/tests.js to make it explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants