Skip to content

Commit

Permalink
Suppress vm module warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tkleinke committed Feb 28, 2025
1 parent a34d315 commit 1efa150
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const detectPort = window.require('detect-port');

if (environment.production) enableProdMode();

suppressWarnings();
start();


Expand Down Expand Up @@ -37,3 +38,19 @@ function showAlreadyOpenError() {
progress.setLocale(Settings.getLocale());
progress.setError('alreadyOpenError');
}


function suppressWarnings() {

const warningTexts: string[] = [
'The vm module of Node.js is deprecated in the renderer process and will be removed.'
];

const warnFunction = console.warn;

console.warn = function() {
if (!warningTexts.find(text => arguments[0].includes(text))) {
return warnFunction.apply(console, arguments);
}
};
}

0 comments on commit 1efa150

Please sign in to comment.