mermaid/.vite/server.ts
Alois Klink 5cfbc9102e build(dev): Fix dev server not showing mermaid.js
When moving to the mono-repo,
`<script src="http://localhost:9000/mermaid.js"/>`
stopped working, since the vite dev server was exposing
the `./dist` folder, when the folder had moved to
the `./packages/mermaid/dist` folder.
2022-09-28 19:52:31 +01:00

27 lines
769 B
TypeScript

import express from 'express';
import { createServer as createViteServer } from 'vite';
// 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
});
app.use(vite.middlewares);
app.use(express.static('./packages/mermaid/dist'));
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();