Comments (20)
Just bumping this thread to let everyone know I'm looking at this now. Thanks for being patient with this one!
from astro.
@Igloczek if it's a non-breaking release (not major) then I think a beta is ok.
from astro.
Thanks for checking @Igloczek . I will set up an example later today, but I suspect the issue is actually just my use of <script setup>
.
from astro.
Okay, this has been a total rabbit hole. Here are some potentially related issues and commits. I'm suspecting that this is an upstream issue, but I'm not sure how to confirm that suspicion.
vuejs/core@8c3c14a#diff-561be13280b90fe64842cc767742d3ade26e09edc35b7db1ea221c3a68297e63R830
from astro.
Okay, this has been a total rabbit hole. Here are some potentially related issues and commits. I'm suspecting that this is an upstream issue, but I'm not sure how to confirm that suspicion.
vuejs/vue-next@8c3c14a#diff-561be13280b90fe64842cc767742d3ade26e09edc35b7db1ea221c3a68297e63R830
The linked repository workes perfectly fine with vue 3.1.2 though, What is your issue with the linked commit, @natemoo-re ?
from astro.
The linked example does work correctly in [email protected]
. But even when I upgrade our Vue renderer to 3.1.2
, I hit (seemingly) the same issue. The difference in our case is that the components are not all at the top-level of the app
, they are recursive.
const B = { template: `<div id="b">B</div>` };
const A = { components: { B }, template: `<div id="a"><B /></div>` };
createApp({
components: { A },
render() {
return h(A, {});
}
})
from astro.
For more context, I see the following in the console, which is part of the problem that was reported.
[Vue warn]: resolveComponent can only be used in render() or setup().
This workaround was suggested but doesn't work in this case.
from astro.
I do actually have some kind of idea what could cause this. I might be completely wrong, but I'll try this - either late today or early tomorrow.
from astro.
Hey, so basically I am not sure what exactly causes this, but I think that vue might not see the nested component as an actual component (does the astro-fragment element get injected between the two components as well? @natemoo-re )
from astro.
I ran into this issue as well. It seems that any custom element, even non-registered inside of a Vue component's template causes
the [Vue warn]: resolveComponent can only be used in render() or setup().
warning and the fatal error [executing astro] TypeError: Invalid value used as weak map key
.
<template>
<what-ever />
</template>
<script>
export default {}
</script>
<style>
</style>
from astro.
It appears that I can get around this issue by using dynamic components: <component :is="SomeComponent" />
<template>
<ul>
<li v-for="post in items" :key="post.url">
<a :href="post.url">{{ post.title }}</a>
<component :is="Tags" :items="post.tags" />
</li>
</ul>
</template>
<script>
import {shallowRef} from '@vue/reactivity';
import Tags from './Tags.vue';
export default {
data() {
return {
Tags: shallowRef(Tags),
}
},
props: {
items: {
type: Array,
default: () => new Array()
}
}
}
</script>
<style>
</style>
Edit: Added shallowRef
wrapper as per Vue's suggestion.
from astro.
Fixed in #858
from astro.
Reopening as we had to revert the change because it was causing issues with client-side Vue. #913
from astro.
I get to the point it actually works, this time on both server and client side.
On Astro side I removed this https://github.com/snowpackjs/astro/blob/main/packages/astro/src/external.ts#L21 to let @vue/server-renderer
be not taken as external source, and be part of the Snowpack cache.
On Vue side, I made a ESM version of @vue/server-renderer
, so we need to wait till this be accepted and package released.
from astro.
Vue stuff merged, we just need to wait for release.
@matthewp do we need to wait for a stable release, or beta will be fine?
from astro.
Ok think it's fixed for real this time! In #924
from astro.
Hi, I am currently getting this issue. I am on Astro 0.20.12
. Any nested Vue components produces a 500 error during build:
[executing astro] TypeError: Invalid value used as weak map key
from astro.
@qjack001 check #1512 thats the Vue changes that landed in v0.20.12, and can break that stuff
from astro.
But... I just checked it in my demo project created for testing this issue, and after upgrading to 0.20.12 everything still works fine. Could you maybe create some reproducible demo?
from astro.
I was able to confirm that the culprit is <script setup>
. There is already an issue open (#1190), so no example needed. Thanks again.
from astro.
Related Issues (20)
- 404.astro in dynamic routes does not create a 404.html HOT 8
- Its not possible to force a full page reload using the navigate function HOT 1
- ViewTransition and Font preload not playing nicely together HOT 5
- Unexpected warning for `<script>` tag with `src` attribute
- i18n: Locale Prefixes in Content Collections cannot be used at root of route HOT 3
- `@astrojs/vercel` adapter isn't building server endpoints. HOT 6
- [MDX] `headings` prop not being properly populated with nested `<Content />` HOT 4
- 4.1.0 removed build information HOT 10
- Hot reload not working in dev HOT 3
- Unable to create indexes on astro db HOT 16
- Astro doesn't respect vite options HOT 2
- Cannot read properties of undefined (reading 'Symbol(drizzle:Columns)') HOT 6
- Broken UTF-8 after update HOT 4
- Video doesn't autoplay after navigating pages with View Transitions HOT 1
- Types for db.batch are incorrect HOT 2
- erronoeous <code> tag rendered in output
- Astro's `prefetch` doesn't work in non-Chromium-based browsers HOT 4
- unused values in build JS HOT 1
- CSS imported into (solid) islands is not loaded on subsequent page loads when using view transitions and client:only in dev HOT 2
- Astro DB - deploy to Vercel fails - Cannot find module 'astro:db' or its corresponding type declarations. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro.