Closed TomasHubelbauer closed 6 years ago
... and here's the beef with babel-transpiled versus native modules.
In the readme, I assumed babel
, which makes this work, even though it should not. Honestly, the whole ES6 modules ecosystem is a bigger mess at this point than when promises were the new hotness.
This should work: import { default as ImapClient } from 'emailjs-imap-client'
Hey, I am using NodeJS v9.4.0 with just
emailjs-imap-client
dependency and code like this:node index.mjs --experimental-modules --harmony
…gives me ImapClient is not a constructor. The reason is that the
ImapClient
object here is not the default export but rather an object with exports. Using this instead works:I am not sure if this library needs to be adapted to support native modules or if I am doing something wrong, but I would have thought that if I do
import * as ImapClient
I'll get object with exports and if I do justimport ImapClient
I will get thedefault
export.Instead when I do
import * as ImapClient
I get object with shape{ default: { LOG_…, default: fn() } }
and if I doimport ImapClient
I get object with shape{ LOG_…, default: fn() }
.Let me know if there is a way I can help debug this further.