Skip to content

Commit e787f36

Browse files
committed
fix(logger): fix winston-daily-rotate-file import for webpack bundling 🔧
- Use require() instead of ES6 import for winston-daily-rotate-file - Handle both CommonJS and ES module exports - Fixes 'DailyRotateFile is not a constructor' error in webpack bundle
1 parent 37b32ae commit e787f36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mcp/src/utils/logger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import fs from 'fs';
22
import os from 'os';
33
import path from 'path';
44
import winston from 'winston';
5-
import DailyRotateFile from 'winston-daily-rotate-file';
5+
// Use require for winston-daily-rotate-file to avoid webpack bundling issues
6+
// Handle both CommonJS and ES module exports
7+
const DailyRotateFileModule = require('winston-daily-rotate-file');
8+
const DailyRotateFile = DailyRotateFileModule.default || DailyRotateFileModule;
69

710
// Get log directory from environment variable or use default
811
const getLogDir = (): string => {

0 commit comments

Comments
 (0)