Skip to content

Commit 1efa150

Browse files
committed
Suppress vm module warning
1 parent a34d315 commit 1efa150

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

desktop/src/main.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const detectPort = window.require('detect-port');
1010

1111
if (environment.production) enableProdMode();
1212

13+
suppressWarnings();
1314
start();
1415

1516

@@ -37,3 +38,19 @@ function showAlreadyOpenError() {
3738
progress.setLocale(Settings.getLocale());
3839
progress.setError('alreadyOpenError');
3940
}
41+
42+
43+
function suppressWarnings() {
44+
45+
const warningTexts: string[] = [
46+
'The vm module of Node.js is deprecated in the renderer process and will be removed.'
47+
];
48+
49+
const warnFunction = console.warn;
50+
51+
console.warn = function() {
52+
if (!warningTexts.find(text => arguments[0].includes(text))) {
53+
return warnFunction.apply(console, arguments);
54+
}
55+
};
56+
}

0 commit comments

Comments
 (0)