diff --git a/packages/vite-plugin-react-board/src/node/index.ts b/packages/vite-plugin-react-board/src/node/index.ts index b7624b4b..0483c1e4 100644 --- a/packages/vite-plugin-react-board/src/node/index.ts +++ b/packages/vite-plugin-react-board/src/node/index.ts @@ -66,7 +66,7 @@ export default function coduxBoardPlugin(): PluginOption { }, configureServer: (server) => { - const { config, middlewares, transformIndexHtml } = server; + const { middlewares, transformIndexHtml } = server; middlewares.use((req, res, next) => { if (res.writableEnded) { @@ -76,12 +76,9 @@ export default function coduxBoardPlugin(): PluginOption { const url = (req as { url: string }).url; const parsedUrl = new URL(url, 'http://localhost'); if (parsedUrl.pathname === '/' + coduxHtmlModuleId) { - Object.entries(config?.server?.headers || {}).forEach(([key, value]) => { - res.setHeader(key, value!); - }); - res.setHeader('Content-Type', 'text/html'); transformIndexHtml(url, coduxEntryHtml, req.originalUrl) .then((output) => { + res.setHeader('Content-Type', 'text/html'); res.statusCode = 200; res.end(output); }) diff --git a/packages/vite-plugin-react-board/test/plugin.unit.ts b/packages/vite-plugin-react-board/test/plugin.unit.ts index c5a670c9..cb525055 100644 --- a/packages/vite-plugin-react-board/test/plugin.unit.ts +++ b/packages/vite-plugin-react-board/test/plugin.unit.ts @@ -43,7 +43,7 @@ describe('codux vite plugin dev server', function () { } }); - it.skip('serves board html entrypoint', async () => { + it('serves board html entrypoint', async () => { const response = await fetch(`http://localhost:${port}/_codux-board-render`, { keepalive: false, });