require chokidar lazily; dev-mode only

This commit is contained in:
Luke Edwards
2018-01-05 00:39:17 -08:00
parent ee94f355d5
commit 0c891ba79e
3 changed files with 6 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
const fs = require('fs');
const path = require('path');
const chokidar = require('chokidar');
const route_manager = require('../route_manager.js');
const { src, entry, dev } = require('../config.js');
@@ -70,7 +69,7 @@ function create_app() {
if (dev) {
route_manager.onchange(create_app);
const watcher = chokidar.watch(`templates/main.js`, {
const watcher = require('chokidar').watch(`templates/main.js`, {
ignoreInitial: true,
persistent: false
});
@@ -80,4 +79,4 @@ if (dev) {
watcher.on('unlink', create_app);
}
module.exports = create_app;
module.exports = create_app;