vite-plugin-virtual-html
vite-plugin-virtual-html copied to clipboard
[vite] Internal server error: Cannot set headers after they are sent to the client
[vite] Internal server error: Cannot set headers after they are sent to the client
at new NodeError (node:internal/errors:372:5)
at ServerResponse.setHeader (node:_http_outgoing:576:11)
at send (/home/user/projects/my_project/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-80fe9c6b.js:57369:9)
at viteIndexHtmlMiddleware (/home/user/projects/my_project/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-80fe9c6b.js:57779:28)
The options of virtualHtml is:
{
pages: { index: '/index.html', button: '/lib/button/index.html' },
indexPage: 'button'
}
Looks like it caused by this:
https://github.com/windsonR/vite-plugin-virtual-html/blob/7fe8d8100d1863ce176b96ae1b93f6ba6b88ec6e/src/plugin.ts#L51
maybe you can test this.
use res.end
to replace res.write
in src/plugin.js
.
long time no response, so close this issue.