diff --git a/lib/platform.js b/lib/platform.js index 205dca2..927fa3b 100644 --- a/lib/platform.js +++ b/lib/platform.js @@ -8,7 +8,7 @@ 'use strict'; -try { var PathWatcher = require('./pathwatcher'); } catch (err) { } +var PathWatcher = null; var statpoll = require('./statpoll.js'); var helper = require('./helper'); var fs = require('graceful-fs'); @@ -20,6 +20,10 @@ var renameWaiting = null; var renameWaitingFile = null; var platform = module.exports = function(file, cb) { + if (PathWatcher == null) { + PathWatcher = require('./pathwatcher'); + } + // Ignore non-existent files if (!fs.existsSync(file)) return;