From 80a145b8e4904665546c18e0a29cff4513b3eb71 Mon Sep 17 00:00:00 2001 From: f0x Date: Wed, 8 Jun 2022 21:49:19 +0200 Subject: [PATCH] only attach update listener on EventEmitter --- web/source/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/web/source/index.js b/web/source/index.js index 248e77c13..10ab776dd 100644 --- a/web/source/index.js +++ b/web/source/index.js @@ -27,8 +27,7 @@ const budoExpress = require('@f0x52/budo-express'); const babelify = require('babelify'); const icssify = require("icssify"); const fs = require("fs"); - -const {Writable} = require("stream"); +const EventEmitter = require('events'); function out(name = "") { return path.join(__dirname, "../assets/dist/", name); @@ -112,7 +111,7 @@ fs.readdirSync(path.join(__dirname, "./css")).forEach((file) => { entryFiles.push(path.join(__dirname, "./css", file)); }); -budoExpress({ +const server = budoExpress({ port: 8081, host: "localhost", entryFiles: entryFiles, @@ -122,7 +121,11 @@ budoExpress({ expressApp: require("./dev-server.js"), browserify: browserifyConfig, livereloadPattern: "**/*.{html,js,svg}" -}).on("update", (contents) => { +}); + +if (server instanceof EventEmitter) { + server.on("update", (contents) => { console.log("writing bundle.js to dist/"); fs.writeFileSync(out("bundle.js"), contents); -}); \ No newline at end of file +}); +} \ No newline at end of file