From 1de50089ce91bfc87c4cbb3ca57b7a04f186173b Mon Sep 17 00:00:00 2001 From: Parola Marco Date: Mon, 19 Oct 2020 10:50:47 +0200 Subject: [PATCH] Now using a "requireLocal" function to use local modules (fuck you, Node.js) --- index.js | 8 +++++++- webpage.js => project_modules/webpage.js | 0 routes/raycast/route.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) rename webpage.js => project_modules/webpage.js (100%) diff --git a/index.js b/index.js index d9a2b72..7e189da 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,11 @@ +global.requireLocal; +requireLocal = function requireLocal(mod) { + return require(__dirname+'/project_modules/'+mod); } + + + const Express = require('express'); -const Webpage = require('./webpage.js'); +const Webpage = requireLocal('webpage.js'); const Fs = require('fs'); const verbose = false; diff --git a/webpage.js b/project_modules/webpage.js similarity index 100% rename from webpage.js rename to project_modules/webpage.js diff --git a/routes/raycast/route.js b/routes/raycast/route.js index 8fdc1a6..2b615c2 100644 --- a/routes/raycast/route.js +++ b/routes/raycast/route.js @@ -1,5 +1,5 @@ const Express = require('express'); -const Webpage = require('../../webpage.js'); +const Webpage = requireLocal('webpage'); const pageTemplate = Webpage.Template.fromFile( __dirname + '/index.html');