diff --git a/.eslintrc.js b/.eslintrc.js index 7d262969..c9ddeba8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,6 +36,7 @@ module.exports = { 'arrow-body-style': 0, 'class-methods-use-this': 0, 'jsdoc/require-returns': 0, + 'jsdoc/tag-lines': 0, 'import/extensions': [ 'error', 'ignorePackages', diff --git a/esbuild.js b/esbuild.js index 783a7f78..5da88459 100644 --- a/esbuild.js +++ b/esbuild.js @@ -29,11 +29,11 @@ esbuild external, define: { 'process.env.NODE_ENV': `"${process.env.NODE_ENV}"` }, platform: 'node', - target: 'node14', + target: 'node18', outfile: 'dist/index.js', tsconfig: 'tsconfig.json', bundle: true, - minify: isDev, + minify: true, sourcemap: isDev, watch: false, }) diff --git a/src/server/core/EventDispatcher/EventDispatcher.ts b/src/server/core/EventDispatcher/EventDispatcher.ts index 00d0b500..6cd1d286 100644 --- a/src/server/core/EventDispatcher/EventDispatcher.ts +++ b/src/server/core/EventDispatcher/EventDispatcher.ts @@ -1,7 +1,13 @@ +/* eslint-disable vars-on-top */ import cron from 'node-cron'; import fs from 'fs-extra'; import { Logger } from '../Logger'; +declare global { + // eslint-disable-next-line no-var + var EventDispatcher: EventDispatcher | undefined; +} + export const EVENT_TYPES = { // System events RESTART: 'restart', @@ -250,4 +256,6 @@ class EventDispatcher { } } -export const EventDispatcherInstance = EventDispatcher.getInstance(); +export const EventDispatcherInstance = global.EventDispatcher || EventDispatcher.getInstance(); + +global.EventDispatcher = EventDispatcherInstance; diff --git a/src/server/index.ts b/src/server/index.ts index 3ed0b8a5..9dec62de 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -25,7 +25,7 @@ if (!dev) { conf = require('./.next/required-server-files.json').config; nextApp = new NextServer({ hostname: 'localhost', dev, port, customServer: true, conf }); } else { - const next = require('next').default; + const next = require('next'); nextApp = next({ dev, hostname, port }); }