substack/watchify — pull request #29 by quarterto (2014-03-18 16:36:20+00:00)
Title: Don't queue undefined watchers for closing

Sometimes (I'm not sure when this happens) a module gets `invalidate`'d before it is `appDep`'d. When it gets to the `close` handler `queuedCloses[depId].close();` throws. Checking that `watchers[id]` exists before putting it in `queuedDeps` seems to fix this without adverse effects.