Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export with cli-plugin-typescript does not work #1452

Closed
p-kuen opened this issue Jun 3, 2018 · 4 comments
Closed

Export with cli-plugin-typescript does not work #1452

p-kuen opened this issue Jun 3, 2018 · 4 comments

Comments

@p-kuen
Copy link

p-kuen commented Jun 3, 2018

Version

3.0.0-beta.15

Reproduction link

https://github.com/Patcher56/vue-flowy/blob/rework/src/main.ts

Steps to reproduce

  1. yarn build: it will build all ts files to js files (everything okay after that)
  2. add the plugin into a vue-cli-project (currently done with yarn link)
  3. try to import import {FlowChart} from 'vue-flowy'
  4. console.log(FlowChart) -> undefined

What is expected?

FlowChart should be an object

What is actually happening?

FlowChart is undefined


Using latest version of vue-cli.
Working with export default for auto installing on main.js on the App and working with export {FlowChart} for exporting my components and classes.

@p-kuen
Copy link
Author

p-kuen commented Jun 3, 2018

Fixed by using the following code:

import VueFlowy from './VueFlowy.vue'
import { VueConstructor } from 'vue';
import FlowChart from './FlowChart'

const Plugin = {
  VueFlowy,
  FlowChart,
  install (Vue: VueConstructor) {
    Vue.component(VueFlowy.name, VueFlowy)
  }
}

export default Plugin

export { VueFlowy, FlowChart }

So I added the component and the class to the Plugin Object. For an unknown reason, the export without the default keyword has no effect.

Can be closed if this is the way to go.

@lossendae
Copy link

The export without default are not exported, this is similar to my issue #1436

@p-kuen
Copy link
Author

p-kuen commented Jun 3, 2018

Oh nice to see that I am not the only one with this problem. I googled an hour long but found not solution except the one above.

Also the watcher for typescript files does not work with vue-cli

@yyx990803
Copy link
Member

I'll close this as a duplicate of #1436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants