Closed jhoermann closed 6 years ago
You can't just use ES6 modules without transpiling. The lib is transpiled to commonjs modules. Your app, however, seems not to be.
Please use babel to transpile your app and enjoy all the latest ECMAScript goodness.
[Edited for clarity]
Thanks for clearing this up. Testing now if this is a viable option for our app. Still I think it would be better to notice that this module is not usable natively with node (without using babel) in the Readme.
Edit: This works for me as a workaround:
var ImapClient = require('emailjs-imap-client');
var client = new ImapClient.default(settings.host, settings.port, { ...
Exactly. The module is natively usable. However, then you have to require
instead of import
in your own code, which has a slightly different semantic.
Thanks for clearing this up. Testing now if this is a viable option for our app. Still I think it would be better to notice that this module is not usable natively with node (without using babel) in the Readme.
Edit: This works for me as a workaround:
var ImapClient = require('emailjs-imap-client');
var client = new ImapClient.default(settings.host, settings.port, { ...
Works for me too :-)
I get this error on startup: `import ImapClient from 'emailjs-imap-client'; ^^^^^^
`
With Node Version:
node -v v9.10.1
As stated here: https://nodejs.org/api/esm.html#esm_unsupported NodeJS is not (yet) compatible with 'import'. My questions:
Greetings, Jochen