#Importing Vue Components from Monorepo Workspace?

15 messages · Page 1 of 1 (latest)

winter sail
#

Is anyone using Astro in a monorepo setup? We're using Turborepo and trying to build an Astro site in a new workspace. We also maintain shared Vue components in another workspace. The problem is that when we try to import a vue component like import { ahcCredit } from 'ahc-ui-common'; (where 'ahc-ui-common' is the workspace name) and then try to use it like <ahcCredit client:load credit-text="blah"></ahcCredit> the Vue component never actually renders.

However, if I copy that component to the Astro site folder under src/components and import it like import Credit from '../components/Credit.vue'; then it renders and works just fine. Any ideas as to why this would be the case? Not being able to use this shared componentry in the monorepo kinda defeats the purpose.

#

I should add that the way we're wanting to import it (from the workspace) has worked fine in the Nuxt app, which we're trying to rebuild in Astro

worn stream
#

In Astro, components need to start with a capital letter, otherwise they're treated as a elements

#

So here you could import it capitalized

#
import { ahcCredit as AhcCredit } from 'ahc-ui-common'
winter sail
#

Even if they're Vue components? I must've missed that.

#

only when I do that, I get Cannot use import statement outside a module and it's referencing something in a different component, one that I tried to use earlier and removed. No idea why that's happening, but I guess that's a new issue.

worn stream
worn stream
winter sail
#

Yeah I don't get it. Astro seems to be throwing errors occuring in Vue components it's not even importing.

#

like it's also complaining about a malformed svg sprite sheet that this component doesn't even use.

worn stream
#

Weird

#

I'd suggest opening an issue

raw terraceBOT
#

Oh no, we'll get this fixed as soon as we can.

Please open an issue on the withastro/astro repo.

winter sail
# worn stream I'd suggest opening an issue

Honestly, I'm willing to chalk it up to just some weirdness in how our monorepo is set up, not necessarily something wrong with Astro. Seems like lots of folks are using a monorepo with it just fine.