Skip to content

A full-featured download manager.

fix: tray worker cannot find module 'lodash'

Dr_rOot3dfd4ec4da70
diff --git a/src/shared/utils/tray.js b/src/shared/utils/tray.js
index dab7344c..7e21639f 100644
--- a/src/shared/utils/tray.js
+++ b/src/shared/utils/tray.js
@@ -1,5 +1,15 @@
import { APP_THEME, TRAY_CANVAS_CONFIG } from '@shared/constants'
-import { bytesToSize } from '@shared/utils'
+
+// Temp Fix: Cannot find module 'lodash'
+// import { bytesToSize } from '@shared/utils'
+const bytesToSize = (bytes) => {
+ const b = parseInt(bytes, 10)
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
+ if (b === 0) { return '0 KB' }
+ const i = parseInt(Math.floor(Math.log(b) / Math.log(1024)), 10)
+ if (i === 0) { return `${b} ${sizes[i]}` }
+ return `${(b / (1024 ** i)).toFixed(1)} ${sizes[i]}`
+}
const lightTextColor = '#000'
const darkTextColor = '#fff'