diff --git a/plugins/adblocker/blocker.ts b/plugins/adblocker/blocker.ts index b534149e..0f1fc268 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 90c51688..8660df0f 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 924728ce..bb210b0b 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(); } };