Search code examples
node.jsnode-modulesdeferred

What's the equivalent of require('deferred') in "import from" with node -v >= 13


I'm not a node expert but as far as I could understand 'require' instructions are no longer in use by default with node version higher than 12. I'm migrating an app written with an old version but I stumble upon the import module instruction. I used to require('deferred')

But I cannot find the equivalent with the import from instructions. I've tried many combination around

import deferred from 'deferred';
import * as deferred from deferred;
...
var d = new deferred();

But I could not get it to work. It's really unclear how this import module works. Could anyone light me on this?

Thanks :)


Solution

  • Thanks eol for your reply.

    I managed to get it to work using

    import Deferred from 'deferred';
    const d =  Deferred();