wonderful-panda/vue-tsx-support

Uncaught TypeError: vca.defineComponent is not a function

wjkang opened this issue · 1 comments

bundle with rollup。

bundled code:

var compositionApi = require('@vue/composition-api');

function _interopDefaultLegacy(e) {
  return e && _typeof(e) === 'object' && 'default' in e ? e : {
    'default': e
  };
}

var compositionApi__default = /*#__PURE__*/_interopDefaultLegacy(compositionApi);
....

 var vca = __importStar(compositionApi__default['default']);

function component(options) {
   return vca.defineComponent(options);
}

console.log(vca) show :

{default: {}, install: ƒ}
default: {install: ƒ}
install: ƒ (Vue)
__proto__: Object

don't have defineComponent

I see the sourcecode in https://github.com/wonderful-panda/vue-tsx-support/blob/master/src/vca.ts

import * as vca from "@vue/composition-api";

why not import { defineComponent, SetupContext } from "@vue/composition-api";

and why tsconfig.json option module is commonjs then bundle vue-tsx-support as commonjs module

why not import { defineComponent, SetupContext } from "@vue/composition-api";

vue-tsx-support 3.0.3 does so. Try it.

and why tsconfig.json option module is commonjs

Honestly, there is no reason at this time. But I also does not have the reason to change it.