Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cylon3035 committed Jan 17, 2025
1 parent fc1b6d4 commit 41c6845
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/vite-plugin-react-board/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
})
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-react-board/test/plugin.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit 41c6845

Please sign in to comment.