How to import node module passing subClass argument to ES6?

In JS, I require in the node gm module (which I want to use with imageMagick, not the default graphicsMagick), passing this argument:

 var gm = require('gm').subClass({ imageMagick: true });

How can I do this in ES6?

import gm from "gm";
gm.subClass({ imageMagick: true });

does not work because gmGraphicsMagick is not installed by default.

+4
source share
1 answer

Reply from @Felix Kling:

import gm from "gm";
const im = gm.subClass({ imageMagick: true });

... using imfrom here!

+4
source

Source: https://habr.com/ru/post/1626861/


All Articles