feat: replace vite with esbuild

This commit is contained in:
Sidharth Vinod
2023-02-19 17:28:35 +05:30
parent f48e48d5fd
commit a0d9069eb0
16 changed files with 182 additions and 316 deletions

25
.esbuild/server.ts Normal file
View File

@@ -0,0 +1,25 @@
import express from 'express';
import cors from 'cors';
import proxy from 'express-http-proxy';
import { getBuildConfig } from './util.js';
import { context } from 'esbuild';
async function createServer() {
const app = express();
const config = getBuildConfig({ minify: false, core: false, entryName: 'mermaid' });
const ctx = await context(config);
ctx.watch();
let { host, port } = await ctx.serve({ servedir: './dist' });
app.use(cors());
app.use(express.static('./packages/mermaid/dist'));
app.use(express.static('./packages/mermaid-example-diagram/dist'));
app.use(express.static('demos'));
app.use(express.static('cypress/platform'));
app.use('/', proxy(`http://${host}:${port}`));
app.listen(9000, () => {
console.log(`Listening on http://localhost:9000`);
});
}
createServer();