Improve Vite resource timeouts
This commit is contained in:
parent
577d912b8e
commit
c4d7dcb7f6
2 changed files with 9 additions and 5 deletions
|
@ -151,7 +151,6 @@ export class AstroDevServer {
|
|||
info(this.logging, 'astro', msg.devHost({ host: `http://${this.hostname}:${this.port}` }));
|
||||
resolve();
|
||||
});
|
||||
this.httpServer?.on('error', onError);
|
||||
};
|
||||
|
||||
const onError = (err: NodeJS.ErrnoException) => {
|
||||
|
@ -170,6 +169,7 @@ export class AstroDevServer {
|
|||
};
|
||||
|
||||
listen();
|
||||
this.httpServer?.on('error', onError);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -365,13 +365,17 @@ export async function renderToString(result: SSRResult, componentFactory: AstroC
|
|||
const uniqueElements = (item: any, index: number, all: any[]) => {
|
||||
const props = JSON.stringify(item.props);
|
||||
const children = item.children;
|
||||
return index === all.findIndex(i => JSON.stringify(i.props) === props && i.children == children)
|
||||
}
|
||||
return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children == children);
|
||||
};
|
||||
|
||||
export async function renderPage(result: SSRResult, Component: AstroComponentFactory, props: any, children: any) {
|
||||
const template = await renderToString(result, Component, props, children);
|
||||
const styles = Array.from(result.styles).filter(uniqueElements).map((style) => renderElement('style', style));
|
||||
const scripts = Array.from(result.scripts).filter(uniqueElements).map((script) => renderElement('script', script));
|
||||
const styles = Array.from(result.styles)
|
||||
.filter(uniqueElements)
|
||||
.map((style) => renderElement('style', style));
|
||||
const scripts = Array.from(result.scripts)
|
||||
.filter(uniqueElements)
|
||||
.map((script) => renderElement('script', script));
|
||||
return template.replace('</head>', styles.join('\n') + scripts.join('\n') + '</head>');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue