From 29c34dee285f359be22f3c1edcbbe9ad41d16bd7 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Fri, 3 Dec 2021 15:36:58 +0530 Subject: chore: do not assume that the recipe contains a 'webview.js' file --- src/webview/recipe.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/webview/recipe.js') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 0b44d1d01..7c069562f 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -16,6 +16,7 @@ import { disable as disableDarkMode, } from 'darkreader'; +import { existsSync } from 'fs'; import ignoreList from './darkmode/ignore'; import customDarkModeCss from './darkmode/custom'; @@ -209,9 +210,11 @@ class RecipeController { notificationsHandler, sessionHandler, ); - // eslint-disable-next-line import/no-dynamic-require - require(modulePath)(this.recipe, { ...config, recipe }); - debug('Initialize Recipe', config, recipe); + if (existsSync(modulePath)) { + // eslint-disable-next-line import/no-dynamic-require + require(modulePath)(this.recipe, { ...config, recipe }); + debug('Initialize Recipe', config, recipe); + } this.settings.service = Object.assign(config, { recipe }); -- cgit v1.2.3-54-g00ecf