#Astro app (with Vue) no longer hydrates client-side after migrating from Astro 2.x to 3.x

82 messages Β· Page 1 of 1 (latest)

mild ermine
#

Can anyone think of any reasons that my app would stop hydrating (for Vue components) after updating from Astro 2.x to 3.x? Literally no other code changes were made.

arctic iris
#

not really πŸ€”. Have you upgraded the @astrojs/vue integration too?

mild ermine
#

yep, that's at 3.0.4. astro is 3.6.4. there are no errors anywhere. but in my Vue components, even just doing a simple test with <div @click="doThis">test</div>, clicking it does nothing

#

this part of the config look ok still?

export default defineConfig({
  output: 'server',
  server: { host: true },
  adapter: aws(),
  integrations: [vue({ appEntrypoint: '/src/vue-main' }), vuetify],
  scopedStyleStrategy: 'class',
  build: {
    assets: 'assets',
  },
#

lemme rule out a potential dev environment issue (though I can't imagine what). gonna push this to staging and see if it still fails

#

ok, build failed

[astro:assets:esm] Could not load /rc-logo-white.svg (imported by src/components/QuickShare.vue): Could not find requested image `/rc-logo-white.svg`. Does it exist?
 error   Could not load /rc-logo-white.svg (imported by src/components/QuickShare.vue): Could not find requested image `/rc-logo-white.svg`. Does it exist?

did something change with how to reference images in public?

        <img
          src="/rc-logo-white.svg"
          alt="ReelCrafter Logo"
          height="60"
        >
arctic iris
mild ermine
#

ok, I can definitely bring it up by going to http://localhost:4321/rc-logo-white.svg. hmmm

#

what on earth

#

changing our code to work w/ Astro 3.x (moving from 2.x) wasn't a huge deal. maybe I should just spring for Astro 4.x and see how that goes πŸ˜„

arctic iris
#

you could always try 🀣

mild ermine
#

image still fails. and hydration is still borked

arctic iris
mild ermine
#

yeah, I went through the breaking changes list. I'll go over it again.

#

client:load is still valid for Vue components, right?

arctic iris
#

yes!

mild ermine
#

πŸ€”

#

lemme spin up a fresh Astro project to see if I can replicate this image issue

#

yep, replicated in a fresh project

#
<script setup lang="ts">
</script>

<template>
  <div>
    <img src="/favicon.svg" />
  </div>
</template>
#

this fails. but if I use the same img tag in an .astro file, it works great

arctic iris
#

oh waw

#

then you might want to open an issue on github

dark gustBOT
#

We love to keep the web weird, but... not that weird.

Please open an issue on the withastro/astro repo.

mild ermine
#

thanks, will do!

#

@arctic iris replicated hydration issues too. how are people using Astro + Vue not filing bug reports left & right? 😳

#

oh wait

#

forgot client:load. one sec

#

ok whew πŸ˜†

#

so that's just in my project. will have to come back to that one.

arctic iris
#

hehe

#

but at least it's weird that images don't resolve πŸ€”

mild ermine
#

very

#

and seems broken in 3.x and 4.x

#

ok.. so there are some boot-up issues in 4.x when I run pnpm dev:

16:43:36 [WARN] [@astrojs/vue] Unable to resolve appEntrypoint `/src/vue-main`. Does the file exist?
16:43:44 [302] /apple-touch-icon-precomposed.png 31ms
16:43:44 [302] /apple-touch-icon.png 31ms
16:43:44 [200] /error 3ms
16:43:44 [200] /error 3ms
[Vue warn]: injection "Symbol(vuetify:defaults)" not found.
[Vue warn]: Unhandled error during execution of setup function
  at <VCard class="wrapper" >
16:43:45 [200] /media/c6d3Y1qUTxi-af-CByPV-A 930ms
16:43:45 [ERROR] [Vuetify] Could not find defaults instance
  Stack trace:
    at /Users/samh/Sites/reelcrafter/v2-presentation/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/vuetify/src/composables/defaults.ts:25:24
    [...] See full stack trace in the browser, or rerun with --verbose.
[Vue warn]: injection "Symbol(vuetify:defaults)" not found.
[Vue warn]: Unhandled error during execution of setup function
  at <VCard class="wrapper" >
16:43:47 [200] /media/c6d3Y1qUTxi-af-CByPV-A 2559ms
16:43:47 [ERROR] [Vuetify] Could not find defaults instance
  Stack trace:
    at /Users/samh/Sites/reelcrafter/v2-presentation/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/vuetify/src/composables/defaults.ts:25:24
    [...] See full stack trace in the browser, or rerun with --verbose.

#
  integrations: [vue({ appEntrypoint: '/src/vue-main' }), vuetify],

nothing crazy there. that actually worked in 3.x.

#

ok, this is a bug too

#

pinging @fringe cape and @upbeat beacon for visibility

#

related: I'm happy to beta test major Astro updates, BTW! could I be put on some email list, if such a thing exists?

fringe cape
#

We just released a fix for appEntrypoint that may have broken things, I’ll take a look

mild ermine
#

thanks Nate! fixing the other issue so my repro is a link to StackBlitz rather than a GItHub repo. it'll be easier that way

fringe cape
mild ermine
#

yeah, I just noticed there was a 4.0.1 out a couple of hours ago

#

and figured it's a newly introduced bug

#

ok, updated repro link on issue #9328

#

can confirm, that was working in 4.0.0

fringe cape
#

Ah, I figured it out

#

There was a change that broke in the Vite dev server but silently passed in the build

#

Our test suite happened to only run the build

mild ermine
#

aha

#

cool. as soon as the entry point thing is fixed, then I can deploy our app to staging to see if this hydration bug is only in dev, or in production too

fringe cape
fringe cape
#

I left a comment on your issue! Would reccommend pinning @astrojs/vue to exactly 4.0.0 in the meantime. Hopefully my PR gets merged first thing tomorrow! https://github.com/withastro/astro/issues/9330#issuecomment-1841837826

GitHub

Astro Info Astro v4.0.1 Node v18.16.0 System macOS (arm64) Package Manager pnpm Output server Adapter astro-sst Integrations @astrojs/vue vuetify If this issue only occurs in one browser, which bro...

terse furnace
#

Just a note here - I had similar issues with 4.0.1 with React. Deleting node_modules and then reinstalling fixed it so maybe worth a try.

mild ermine
#

@fringe cape thank you, I appreciate you!

#

Now to dig into the Vue hydration issue (tomorrow)

mild ermine
#

@cunning needle nice find on that image bug! I don't remember even seeing anything in the error about Vite, but great catch πŸ™‚ I imagine I could also just move the svg into src/assets vs public, and that'd do the trick

cunning needle
#

Yeah, I went through a rabbit hole this morning with this, ha! The issue is actually in multiple repos, the Vue compiler does something weird, the Vue Vite plugin doesn't respect the options correctly and we don't do anything

mild ermine
#

are Vue/Vite maintainers aware of this?

cunning needle
#

I'm planning to send a PR to their Vite plugin to fix the issue!

mild ermine
#

you are a rockstar

cunning needle
#

I think the weird behaviour in the Vue compiler is intended for Nuxt and stuff

mild ermine
#

ahh

cunning needle
#

We'll fix what we can πŸ˜„

#

Hopefully the workaround is enough for your usecase at the moment!

mild ermine
#

yes, thank you! I'll give it a shot today. also maybe moving the svg into assets. it's just a small logo, so it probably belongs there anyway

mild ermine
#

ok, confirmed.. hydration bug is in dev mode only πŸ˜• ugh. I mean, that's better than production, but now I can't test stuff locally

#

anyone here available (for an hourly rate) to help get to the bottom of this?

#

otherwise I think I'll just have to cull huge parts of the codebase until it works.. then figure out what it was that was removed that was causing it. gotta be some dependency that's getting in the way

mild ermine
#

omg.. hydration issue fixed. this shouldn't be happening, BUT:

<script setup lang="ts">
import { ref, computed, StyleValue } from 'vue';

that was the issue. changed that line to:

import { ref, computed, type StyleValue } from 'vue';

and now it's good, all works well. I'm not so sure simple TS errors like that should cause the app to break! hard to say where this issue lies, too, but I'm guessing Vite πŸ˜„

@fringe cape @cunning needle ☝️

fringe cape
#

🀦 These are the worst kind of issues!

mild ermine
#

haha

fringe cape
#

Very glad you were able to figure it out!

mild ermine
#

"whole app is busted, must be something major"

...

nope. literally one word removed = fix

fringe cape
#

Vue is probably doing some hashing based on the contents of the file? Betting that StyleValue could be treeshaken in one environment but not the other for whatever reason

mild ermine
#

that's me, someday. just gonna toss my computer out the window and move to the mountains. goodbye, web dev world

#

you get a bit tired after doing it for 26 years πŸ˜…

mild ermine
#

Astro's been great to work with so far, BTW. Astro on Lambda is blazing fast. our pages get a ton of traffic all day (around 1.5M hits per week), and people are sending private portfolio pages to Disney, Netflix, and more, so reliability is key for us. so thank you to you & the team for all your hard work!