wonderful-panda / vue-tsx-support

TSX (JSX for TypeScript) support library for Vue
MIT License
560 stars 40 forks source link

Build error when using vue-tsx-support/lib/vca #89

Closed Spaubleit closed 2 years ago

Spaubleit commented 3 years ago

Hi. I try to use this library with nuxtjs. But I get error when I try example:

import { computed, defineComponent } from "@vue/composition-api";
import * as vca from "vue-tsx-support/lib/vca"

const MyComponent = vca.component({
  name: "MyComponent",
  props: {
    text: { type: String, required: true },
    important: Boolean,
  },
  setup(p) {
    const className = computed(() => p.important ? "label-important" : "label-normal");
    return () => (
      <span class={className.value}>{p.text}</span>;
  );
  }
});

export default MyComponent;

I get build error like this:

Module not found: Error: Can't resolve 'vue-tsx-support/lib/vca' in ... What I do wrong? I installed the library, changed package.json and .babelrc. I'd happy provide additional information if needed.

TheoBP commented 3 years ago

I have the same issue, it only happens with 3.2.0.

medairbit commented 3 years ago

Here's a workaround for nuxt projects:

Note: We could have added vue-tsx-support/lib/vca as the alias target directly but it won't work in the ssr mode. (https://github.com/nuxt/nuxt.js/issues/3439)

Spaubleit commented 2 years ago

Thank you! It works with with this changes. Sorry for long response. I was away from that project.