Import/Require correct way to do it
Opened this issue · 7 comments
If winston-cloudwatch
is a library, why the README
says in Usage WinstonCloudWatch = require('../index');
Because I did not spot the issue, that particular line in the README is 3 years old and has been taken from the examples.
Thanks, corrected!
So I'm using 1.13.1, because I prefer Winston 2.x. However, I can't import or require at all!
import WinstonCloudWatch from 'winston-cloudwatch';
console.log(WinstonCloudWatch);
prints {}
.
import * as WinstonCloudWatch from 'winston-cloudwatch';
console.log(WinstonCloudWatch);
prints { default: {}, [Symbol(__esModule)]: true }
.
Similarly with const WinstonCloudWatch = require('winston-cloudwatch');
.
Seems like nothing is exported... Any ideas?
Are you importing first winston?
Yes! I'm using Meteor, but that should not make any difference.
Hello @angelmartinez-wz, which Node.js version are you using?
I think that your issue is related to the fact that you're import
ing winston-cloudwatch. It's been quite a while since I wrote a Node.js program, but I don't think I've written this library with ES6 modules in mind, I'm simply using module.exports
. If you try to require
it the old way it should work.
Sorry if this sounds strange, but I've been disconnected from the Node.js scene for quite a while now :D
@lazywithclass I assume you mean me :) thanks for your response, but as mentioned in my comment, I also tried require
ing it with the same result
Yes I meant you ^^"
I did not notice you mentioned require
too, sorry. Could you please paste here the minimum example that does not work when you use require
, along with Node.js version, etc?
Thanks!