fix(web): fixed compilation with create-torrent #148

This commit is contained in:
Alexey Kasyanchuk 2021-07-11 11:58:30 +03:00
parent 5a8ee5bd52
commit bceb070b74
3 changed files with 6 additions and 2 deletions

1
package-lock.json generated
View File

@ -14,6 +14,7 @@
"bitfield": "^3.0.0", "bitfield": "^3.0.0",
"cheerio": "^1.0.0-rc.10", "cheerio": "^1.0.0-rc.10",
"compare-versions": "^3.6.0", "compare-versions": "^3.6.0",
"create-torrent": "3.33.0",
"debug": "^4.3.1", "debug": "^4.3.1",
"detect-onebyte-encoding": "^1.0.3", "detect-onebyte-encoding": "^1.0.3",
"electron-context-menu": "^3.1.1", "electron-context-menu": "^3.1.1",

View File

@ -139,7 +139,8 @@
"react-plotly.js": "^2.5.1", "react-plotly.js": "^2.5.1",
"simple-encryptor": "github:DEgITx/node-simple-encryptor", "simple-encryptor": "github:DEgITx/node-simple-encryptor",
"stun": "1.1.0", "stun": "1.1.0",
"webtorrent": "github:DEgITx/webtorrent" "webtorrent": "github:DEgITx/webtorrent",
"create-torrent": "3.33.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.3", "@babel/core": "^7.14.3",

View File

@ -6,7 +6,9 @@ import Search from './search'
import Tooltip from './tooltip' import Tooltip from './tooltip'
import ContextMenu from './context-menu' import ContextMenu from './context-menu'
import createTorrent from 'create-torrent'; let createTorrent;
if(typeof WEB === 'undefined')
createTorrent = require('create-torrent')
import fs from 'fs' import fs from 'fs'
let dialog let dialog
if(typeof WEB === 'undefined') if(typeof WEB === 'undefined')