winston-transport-sentry-node
winston-transport-sentry-node copied to clipboard
ES6 Usage
Hi there, how are you supposed to import the transport when moduleResolution is set to node next, and ESNext is being used? I tried
import Sentry from 'winston-transport-sentry-node';
However that results in This expression is not constructable.
Type 'typeof import("/Users/net-tech-/Desktop/Programming/old-kydzs-splatoon/node_modules/.pnpm/[email protected]/node_modules/winston-transport-sentry-node/dist/transport")' has no construct signatures.
48 new Sentry({
~~~~~~
This worked for me:
import SentryWinston from 'winston-transport-sentry-node';
const WinstonSentry = SentryWinston.default
const logger = createLogger({
transports: [
new transports.Console(),
...
new WinstonSentry(options)
],
});
@sergioisidoro that unfortunately didn't work for me, but this code compiled and ran okay:
import * as SentryWinston from 'winston-transport-sentry-node';
const Sentry = SentryWinston.default;