-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static Vue HTML is being hydrated. #12899
Comments
Are you seeing this in build or just dev? I tried your repro, running |
Hey @ascorbic, Thanks for checking this. This was happening to me on production as well. I am using Netlify so I am unable to use |
You can run locally with the Netlify CLI: |
Hello @eslamodeh. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Hey @ascorbic, I have tried to replicate this in a new GitHub repository but unfortunately have failed. However, I have replicated(exact copy paste of the code) between two environments and check this: New environment(as we expected): My old environment: The only difference between new and old environment is that the old environment(or the current code base I have) got plenty of Vue files. Thus, I am suspecting those 3 JS files being exported because Vue somehow noticed many files and decided to export them? I am quite unsure but would be really great If have a large code base could potentially be an issue here? For clarity, here is the following code structure:
---
import FullScreenHero from '@src/components/theme/Hero/FullScreen.astro';
---
<FullScreenHero title="My title"
description="My description"
primary_cta_text="My CTA"/>
---
interface Props {
title: string,
description: string,
primary_cta_text?: string,
sub_hero?: boolean
}
import HeroElement from './FullScreen.vue'
const props = Astro.props as Props
---
<HeroElement client:load {...props} />
<script setup>
import H1 from "@src/components/elements/H1.vue";
import P from "@src/components/elements/P.vue";
</script>
<template>
<div>
<div class="relative isolate">
<div class="mx-auto py-32 mt-20">
<div class="text-center">
<H1 class="h1 text-balance">{{ title }}</H1>
<P class="p text-pretty font-medium mt-8">{{ description }}</P>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
title: {
type: String,
required: true,
},
description: {
type: String,
required: false,
},
primary_cta_text: {
type: String,
required: false,
},
sub_hero: {
type: Boolean,
required: false,
},
},
};
</script> |
Unfortunately without an isolated repro, this could be anything. If you can't reproduce one from scratch, the next best is to create one be removing stuff from your existing repo until it starts working correctly. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I have a component, let's call it
A.astro
A.astro
renders another component calledA.vue
.A.vue looks like:
Note that H1 and H2 is static html only(no JS logic at all).
A.astro
simply uses:The problem:
The browser makes 3 JS request to download A.vue, H1.vue, and H2.vue components. However, H1 & H2 must not be rendered a JS component since they're purely HTML.
What's the expected result?
It's expected that Astro doesn't render H1 & H2 as Javascript components if they are static HTML.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-ctq6mph8?file=src%2Fpages%2FA.astro
Participation
The text was updated successfully, but these errors were encountered: