mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 22:05:20 +00:00
require chokidar lazily; dev-mode only
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
const chokidar = require('chokidar');
|
||||
const { dev } = require('./config.js');
|
||||
|
||||
let templates;
|
||||
@@ -65,7 +64,7 @@ function create_templates() {
|
||||
create_templates();
|
||||
|
||||
if (dev) {
|
||||
const watcher = chokidar.watch('templates/**.html', {
|
||||
const watcher = require('chokidar').watch('templates/**.html', {
|
||||
ignoreInitial: true,
|
||||
persistent: false
|
||||
});
|
||||
@@ -87,4 +86,4 @@ exports.stream = (res, status, data) => {
|
||||
if (template) return template.stream(res, data);
|
||||
|
||||
return `Missing template for status code ${status}`;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user