fix: use ESM import for mkdirSync instead of require()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 08:29:20 +05:30
parent 9f399f33e4
commit ac49f0a542

View File

@@ -1,6 +1,6 @@
// server/src/services/notifications.ts
import { createTransport } from 'nodemailer';
import { readFileSync, writeFileSync, existsSync } from 'fs';
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
import { resolve } from 'path';
import { randomUUID } from 'crypto';
import type { MonitorUser, Notification, UserRole } from '../types/index.js';
@@ -11,7 +11,6 @@ const USERS_FILE = resolve(DATA_DIR, 'users.json');
const NOTIFICATIONS_FILE = resolve(DATA_DIR, 'notifications.json');
function ensureDataDir() {
const { mkdirSync } = require('fs');
try { mkdirSync(DATA_DIR, { recursive: true }); } catch {}
}