0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

Make Non-HTML Pages work for static build (#2638)

* Make Non-HTML Pages work for static build

* Check hasOwnProperty instead of length

* Fix typo "> 0"
This commit is contained in:
Joel Kuzmarski 2022-02-22 03:53:21 -06:00 committed by GitHub
parent ad3f3cf41d
commit f165b78ad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,10 +50,10 @@ export async function render(renderers: Renderer[], mod: ComponentInstance, ssrO
const { astroConfig, filePath, logging, mode, origin, pathname, route, routeCache, viteServer } = ssrOpts;
// Add hoisted script tags
const scripts = createModuleScriptElementWithSrcSet(astroConfig.buildOptions.experimentalStaticBuild ? Array.from(mod.$$metadata.hoistedScriptPaths()) : []);
const scripts = createModuleScriptElementWithSrcSet(astroConfig.buildOptions.experimentalStaticBuild && mod.hasOwnProperty('$$metadata') ? Array.from(mod.$$metadata.hoistedScriptPaths()) : []);
// Inject HMR scripts
if (mode === 'development' && astroConfig.buildOptions.experimentalStaticBuild) {
if (mod.hasOwnProperty('$$metadata') && mode === 'development' && astroConfig.buildOptions.experimentalStaticBuild) {
scripts.add({
props: { type: 'module', src: '/@vite/client' },
children: '',