Moved image require to service

This commit is contained in:
Essem 2022-01-29 15:08:27 -06:00
parent 6aa1bf7ff6
commit 5da6207f8a
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
2 changed files with 4 additions and 3 deletions

3
app.js
View File

@ -28,9 +28,6 @@ const exec = promisify(baseExec);
// dbl posting
import { Api } from "@top-gg/sdk";
const dbl = process.env.NODE_ENV === "production" && process.env.DBL ? new Api(process.env.DBL) : null;
// only requiring this to work around an issue regarding worker threads
const nodeRequire = createRequire(import.meta.url);
nodeRequire(`./build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
if (isMaster) {
const esmBotVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url))).version;

View File

@ -5,6 +5,10 @@ import path from "path";
import { fileURLToPath } from "url";
import { Worker } from "worker_threads";
// only requiring this to work around an issue regarding worker threads
const nodeRequire = createRequire(import.meta.url);
nodeRequire(`./build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
import ImageConnection from "../imageConnection.js";
class ImageWorker extends BaseServiceWorker {