Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 Usage #45

Open
net-tech opened this issue Jun 22, 2023 · 2 comments
Open

ES6 Usage #45

net-tech opened this issue Jun 22, 2023 · 2 comments

Comments

@net-tech
Copy link

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({
           ~~~~~~
@sergioisidoro
Copy link

sergioisidoro commented Oct 23, 2023

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)
  ],
});

@d-neri
Copy link

d-neri commented May 1, 2024

@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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants