mirror of
https://github.com/WorldEditAxe/eaglerproxy.git
synced 2024-12-21 14:54:13 -08:00
Handle failure to import jimp
This commit is contained in:
parent
8c151fbd8b
commit
a543a8d62b
|
@ -1,3 +1,4 @@
|
|||
import { Logger } from "../../logger.js";
|
||||
import { Constants } from "../Constants.js";
|
||||
import { Enums } from "../Enums.js";
|
||||
import { MineProtocol } from "../Protocol.js";
|
||||
|
@ -17,7 +18,16 @@ export namespace ImageEditor {
|
|||
if (loadedLibraries) return;
|
||||
if (native) sharp = (await import("sharp")).default;
|
||||
else {
|
||||
// Jimp = (await import("jimp")).default;
|
||||
try {
|
||||
Jimp = (await import("jimp")).default;
|
||||
} catch (err) {
|
||||
const logger = new Logger("ImageEditor.js");
|
||||
logger.fatal("**** ERROR: UNABLE TO LOAD JIMP!");
|
||||
logger.fatal("Please ensure that Jimp is installed by running 'npm install jimp' in the terminal.");
|
||||
logger.fatal("If you'd like to use the faster native image editor, please set the 'useNatives' option in the config to true.");
|
||||
logger.fatal(`Error: ${err.stack}`);
|
||||
process.exit(1);
|
||||
}
|
||||
Jimp.appendConstructorOption(
|
||||
"Custom Bitmap Constructor",
|
||||
(args) => args[0] && args[0].width != null && args[0].height != null && args[0].data != null,
|
||||
|
|
Loading…
Reference in New Issue
Block a user