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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: util.inherits is not a function #2443

Open
zN3utr4l opened this issue Apr 8, 2024 · 1 comment
Open

[Bug]: util.inherits is not a function #2443

zN3utr4l opened this issue Apr 8, 2024 · 1 comment

Comments

@zN3utr4l
Copy link

zN3utr4l commented Apr 8, 2024

馃攷 Search Terms

util.inherits

The problem

vue-router.js?v=605fd534:2504 TypeError: util.inherits is not a function
    at node_modules/winston-transport/modern.js (chunk-LH3SSF2F.js?v=605fd534:16109:10)
    at __require2 (chunk-GFT2G5UO.js?v=605fd534:18:50)
    at node_modules/winston-transport/legacy.js (chunk-LH3SSF2F.js?v=605fd534:16199:27)
    at __require2 (chunk-GFT2G5UO.js?v=605fd534:18:50)
    at node_modules/winston/dist/winston/logger.js (chunk-LH3SSF2F.js?v=605fd534:16511:33)
    at __require2 (chunk-GFT2G5UO.js?v=605fd534:18:50)
    at node_modules/winston/dist/winston/create-logger.js (chunk-LH3SSF2F.js?v=605fd534:17132:18)
    at __require2 (chunk-GFT2G5UO.js?v=605fd534:18:50)
    at node_modules/winston/dist/winston.js (chunk-LH3SSF2F.js?v=605fd534:17349:28)
    at __require2 (chunk-GFT2G5UO.js?v=605fd534:18:50)
triggerError	@	vue-router.js?v=605fd534:2504
Show less

What version of Winston presents the issue?

v3.13

What version of Node are you using?

v20.11.1

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

import { format, createLogger, transports } from 'winston'
import 'winston-daily-rotate-file'
const { combine, timestamp, prettyPrint } = format

const timezoned = () => new Date().toLocaleString('UTC', { timeZone: 'UTC' })

const logger = createLogger({
  level: 'debug',
  format: combine(
    timestamp({
      format: 'MMM-DD-YYYY HH:mm:ss',
    }),
    prettyPrint()
  ),
  transports: [
    new transports.DailyRotateFile({
      level: 'info',
      filename: 'logs/info-%DATE%.log',
      datePattern: 'YYYY-MM-DD',
      maxFiles: '5d',
      maxSize: '100m',
      format: format.combine(format.timestamp({ format: timezoned }), format.prettyPrint()),
    }),
    new transports.DailyRotateFile({
      level: 'error',
      filename: 'logs/error-%DATE%.log',
      datePattern: 'YYYY-MM-DD',
      maxFiles: '5d',
      maxSize: '100m',
      format: format.combine(format.timestamp({ format: timezoned }), format.prettyPrint()),
    }),
    new transports.Console({ format: format.simple() }), // only for debug
  ]
})

export default logger

Additional information

No response

@zN3utr4l
Copy link
Author

zN3utr4l commented Apr 8, 2024

image

after adding nodePolyfills() to vite.config.ts

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

No branches or pull requests

1 participant