fix(plugins): resolve leads and nanobana runtime imports dynamically for production dist compatibility

This commit is contained in:
VPS 4 Deploy Agent
2026-05-11 05:28:55 +02:00
parent f95ac82558
commit 201594b5a1
2 changed files with 15 additions and 7 deletions
@@ -1,7 +1,16 @@
import { Router, Request, Response } from 'express';
import { PluginContext } from '../../../backend/src/core/types';
import { authenticate } from '../../../backend/src/middleware/auth';
import { authorize } from '../../../backend/src/middleware/rbac';
let authenticate: any;
let authorize: any;
if (process.env.NODE_ENV === 'production') {
authenticate = require('../../../dist/middleware/auth').authMiddleware;
authorize = require('../../../dist/middleware/rbac').adminMiddleware;
} else {
authenticate = require('../../../backend/src/middleware/auth').authMiddleware;
authorize = require('../../../backend/src/middleware/rbac').adminMiddleware;
}
const STATUS_VALUES = ['new', 'contacted', 'qualified', 'converted', 'lost'];
const LEAD_TYPE_VALUES = ['cold', 'member'];