fix: Vite URL bug (#1746)

This commit is contained in:
Drew Powers 2021-11-05 09:26:20 -06:00 committed by GitHub
parent 1a48bb73df
commit ecfc298506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56983,7 +56983,7 @@ const devHtmlHook = async (html, { path: htmlPath, server, originalUrl }) => {
// add HTML Proxy to Map
addToHTMLProxyCache(config, url, scriptModuleIndex, contents);
// inline js module. convert to src="proxy"
s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${filePath}?html-proxy&index=${scriptModuleIndex}.js"></script>`);
s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${config.base + url.slice(1)}?html-proxy&index=${scriptModuleIndex}.js"></script>`);
}
}
// elements with [href/src] attrs