2022-09-22 15:35:22 +05:30
|
|
|
import express from 'express';
|
2022-09-23 10:56:39 +05:30
|
|
|
import { createServer as createViteServer } from 'vite';
|
2022-09-22 15:35:22 +05:30
|
|
|
// import { getBuildConfig } from './build';
|
|
|
|
|
|
|
|
async function createServer() {
|
|
|
|
const app = express();
|
|
|
|
|
|
|
|
// Create Vite server in middleware mode
|
|
|
|
const vite = await createViteServer({
|
|
|
|
configFile: './vite.config.ts',
|
|
|
|
server: { middlewareMode: true },
|
|
|
|
appType: 'custom', // don't include Vite's default HTML handling middlewares
|
|
|
|
});
|
|
|
|
|
2022-09-23 10:40:56 +05:30
|
|
|
app.use(vite.middlewares);
|
2022-09-28 19:52:31 +01:00
|
|
|
app.use(express.static('./packages/mermaid/dist'));
|
2022-10-03 07:01:56 +02:00
|
|
|
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
|
|
|
app.use(express.static('./packages/mermaid-mindmap/dist'));
|
2022-09-22 15:35:22 +05:30
|
|
|
app.use(express.static('demos'));
|
|
|
|
app.use(express.static('cypress/platform'));
|
|
|
|
|
|
|
|
app.listen(9000, () => {
|
|
|
|
console.log(`Listening on http://localhost:9000`);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// build(getBuildConfig({ minify: false, watch: true }));
|
|
|
|
createServer();
|