diff --git a/react-packager/src/Server/index.js b/react-packager/src/Server/index.js index ef35844f..c7ab61be 100644 --- a/react-packager/src/Server/index.js +++ b/react-packager/src/Server/index.js @@ -16,11 +16,18 @@ const Bundler = require('../Bundler'); const Promise = require('promise'); const SourceMapConsumer = require('source-map').SourceMapConsumer; -const _ = require('lodash'); const declareOpts = require('../lib/declareOpts'); const path = require('path'); const url = require('url'); +function debounce(fn, delay) { + var timeout; + return () => { + clearTimeout(timeout); + timeout = setTimeout(fn, delay); + }; +} + const validateOpts = declareOpts({ projectRoots: { type: 'array', @@ -209,7 +216,7 @@ class Server { this._fileWatcher.on('all', this._onFileChange.bind(this)); - this._debouncedFileChangeHandler = _.debounce(filePath => { + this._debouncedFileChangeHandler = debounce(filePath => { this._clearBundles(); this._informChangeWatchers(); }, 50);