fix(plugins): resolve UnifiedStorageProvider and ext-api imports dynamically for production dist
This commit is contained in:
@@ -22,9 +22,19 @@ import type { Knex } from 'knex'
|
||||
import type { WhatsAppConnectionManager } from '../../../backend/src/modules/whatsapp/connection/WhatsAppConnectionManager'
|
||||
import type { PluginConfigStore } from '../../../backend/src/core/plugin-config'
|
||||
import type { HookBus } from '../../../backend/src/core/hook-bus'
|
||||
import { dragonfly } from '../../../backend/src/infra/cache/dragonfly'
|
||||
let dragonfly: any;
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
dragonfly = require('../../../dist/infra/cache/dragonfly').dragonfly;
|
||||
} else {
|
||||
dragonfly = require('../../../backend/src/infra/cache/dragonfly').dragonfly;
|
||||
}
|
||||
import { ProtocolEngine } from '../../secretaria/brain'
|
||||
import { sendRichMessage } from '../../../backend/dist/modules/whatsapp/rich-message'
|
||||
let sendRichMessage: any;
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
sendRichMessage = require('../../../dist/modules/whatsapp/rich-message').sendRichMessage;
|
||||
} else {
|
||||
sendRichMessage = require('../../../backend/dist/modules/whatsapp/rich-message').sendRichMessage;
|
||||
}
|
||||
|
||||
function uuid(): string {
|
||||
try { return (crypto as any).randomUUID() } catch { return `${Date.now()}-${Math.random().toString(36).slice(2)}` }
|
||||
|
||||
Reference in New Issue
Block a user