fix(server): require next server
This commit is contained in:
parent
15f63551e7
commit
fee9f0f39b
4 changed files with 13 additions and 4 deletions
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue