fix(vite-plugin): add missing headers to html (#219)

This commit makes it possible to run Motion Canvas in GitHub Codespaces.

Closes: #201
This commit is contained in:
Jacob
2023-02-06 17:57:57 +01:00
committed by GitHub
parent 6cd1b952df
commit 2552bcfbe2

View File

@@ -297,12 +297,14 @@ export default ({
}
if (req.url === '/') {
res.setHeader('Content-Type', 'text/html');
res.end(createHtml('/@id/__x00__virtual:editor'));
return;
}
const name = req.url?.slice(1);
if (name && name in projectLookup) {
res.setHeader('Content-Type', 'text/html');
res.end(createHtml(`/@id/__x00__virtual:editor?project=${name}`));
return;
}