Skip to content

Commit

Permalink
Allow adblocker module to be tree-shaked for builds without a bundled…
Browse files Browse the repository at this point in the history
… filterlist (#567)

- Bundle size from >500k -> 250k
  • Loading branch information
sammacbeth authored Dec 10, 2024
1 parent fbfd8e6 commit 69a3524
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class AutoConsent {

if (config.enableFilterList) {
try {
if (serializedEngine && serializedEngine.length > 0) {
if (BUNDLE_FILTERLIST && serializedEngine && serializedEngine.length > 0) {
this.filtersEngine = deserializeFilterList(serializedEngine);
}
} catch (e) {
Expand Down Expand Up @@ -491,7 +491,7 @@ export default class AutoConsent {
return false;
}
const logsConfig = this.config?.logs;
if (!styles) {
if (BUNDLE_FILTERLIST && !styles) {
styles = getCosmeticStylesheet(this.filtersEngine);
}

Expand Down Expand Up @@ -543,7 +543,7 @@ export default class AutoConsent {
}

filterListFallback() {
if (!this.filtersEngine) {
if (!BUNDLE_FILTERLIST) {
this.updateState({ lifecycle: 'nothingDetected' });
return false;
}
Expand Down

0 comments on commit 69a3524

Please sign in to comment.