Skip to content

Commit

Permalink
V3: Fix environment checks (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaOlejniczak authored Nov 26, 2024
1 parent fd0b537 commit b586f87
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/core/core/src/atlaspack-v3/worker/compat/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,35 @@ export class Environment implements IEnvironment {
this.unstableSingleFileOutput = false;
}

// TODO
isBrowser(): boolean {
return true;
return (
this.context === 'browser' ||
this.isWorker() ||
this.isWorklet() ||
this.context === 'electron-renderer'
);
}

// TODO
isNode(): boolean {
return false;
return this.context === 'node' || this.isElectron();
}

// TODO
isElectron(): boolean {
return false;
return (
this.context === 'electron-main' || this.context === 'electron-renderer'
);
}

// TODO
isWorker(): boolean {
return false;
return this.context === 'web-worker' || this.context === 'service-worker';
}

// TODO
isWorklet(): boolean {
return false;
return this.context === 'worklet';
}

// TODO
isIsolated(): boolean {
return false;
return this.isWorker() || this.isWorklet();
}

// TODO
Expand Down

0 comments on commit b586f87

Please sign in to comment.