Convert backend code to ES modules

Bundling code now with Rollup for its flat bundling and tree shaking
support. Front end code still goes through Webpack for browser support.
This commit is contained in:
Zaid Abdulla committed 2019-02-04 23:47:54 -08:00
1 parent 824639976f
commit 1e41c72d60
62 files changed
+718 -898

No files matched your search

+13 -20
View File
@@ -1,20 +1,19 @@
#!/usr/bin/env node
#!/usr/bin/env -S node -r esm
"use strict";
const path = require("path");
const fs = require("fs");
import path from "path";
import fs from "fs";
process.chdir(path.resolve(path.dirname(fs.realpathSync(__filename)), ".."));
const config = require("../lib/config");
const logger = require("../lib/logger");
const cluster = require("../lib/cluster");
const server = require("../lib/server");
const nbi = require("../lib/nbi");
const db = require("../lib/db");
const extensions = require("../lib/extensions");
const cache = require("../lib/cache");
const VERSION = require("../package.json").version;
import * as config from "../lib/config";
import * as logger from "../lib/logger";
import * as cluster from "../lib/cluster";
import * as server from "../lib/server";
import { listener } from "../lib/nbi";
import * as db from "../lib/db";
import * as extensions from "../lib/extensions";
import * as cache from "../lib/cache";
import { version as VERSION } from "../package.json";
logger.init("nbi", VERSION);
@@ -103,13 +102,7 @@ if (!cluster.worker) {
if (err) throw err;
cache.connect(err => {
if (err) throw err;
server.start(
SERVICE_PORT,
SERVICE_ADDRESS,
ssl,
nbi.listener,
nbi.onConnection
);
server.start(SERVICE_PORT, SERVICE_ADDRESS, ssl, listener);
});
});
}