From e86739c99c3b38e1438d11d52297629dc17ff342 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Wed, 4 Oct 2023 20:59:32 +0900 Subject: [PATCH] fix: fix #29 --- plugins/adblocker/blocker.ts | 3 --- plugins/adblocker/inject-cliqz-preload.ts | 2 +- plugins/adblocker/preload.ts | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/adblocker/blocker.ts b/plugins/adblocker/blocker.ts index b534149e0a..0f1fc26899 100644 --- a/plugins/adblocker/blocker.ts +++ b/plugins/adblocker/blocker.ts @@ -68,6 +68,3 @@ export const loadAdBlockerEngine = ( }; export default { loadAdBlockerEngine }; -if (require.main === module) { - loadAdBlockerEngine(); // Generate the engine without enabling it -} diff --git a/plugins/adblocker/inject-cliqz-preload.ts b/plugins/adblocker/inject-cliqz-preload.ts index 90c51688e0..8660df0fb6 100644 --- a/plugins/adblocker/inject-cliqz-preload.ts +++ b/plugins/adblocker/inject-cliqz-preload.ts @@ -1,4 +1,4 @@ export default () => { - const path = require.resolve('@cliqz/adblocker-electron-preload'); // prevent require hoisting + const path = '@cliqz/adblocker-electron-preload'; // prevent require hoisting require(path); }; diff --git a/plugins/adblocker/preload.ts b/plugins/adblocker/preload.ts index 924728ce5d..bb210b0b6f 100644 --- a/plugins/adblocker/preload.ts +++ b/plugins/adblocker/preload.ts @@ -1,4 +1,4 @@ -import config from './config'; +import config, { blockers } from './config'; import inject from './inject'; import injectCliqzPreload from './inject-cliqz-preload'; @@ -7,7 +7,7 @@ export default async () => { // Preload adblocker to inject scripts/styles injectCliqzPreload(); // eslint-disable-next-line @typescript-eslint/await-thenable - } else if ((await config.get('blocker')) === config.blockers.InPlayer) { + } else if ((await config.get('blocker')) === blockers.InPlayer) { inject(); } };