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 'defineComponent | computed | etc' was not found in 'vue' #25

Closed
alvarosabu opened this issue Dec 28, 2020 · 4 comments
Closed

Comments

@alvarosabu
Copy link

alvarosabu commented Dec 28, 2020

Hi, sorry that I'm creating a following issue to #22 but I don't have the right to re-open and I'm still a little bit stuck.

Problem

"export 'defineComponent | computed |. etc' was not found in 'vue'

Since my library exports components created using defineComponent it doesn't work in a project with vue 2
Screenshot 2020-12-28 at 12 03 11

Steps

  1. I created a PR to follow the process described in the README.md in my library, changed vue imports to vue-demi, added the peerDependencies, and installed everything.
  2. Publish a new version 3.11.0
  3. In this branch I installed the last version on the vue 2 demo app ---> link
  4. Run npm run serve

If I understand correctly it's necessary to publish the npm package for vue-demi to work when installing on a Vue 2 or 3 project, is not possible to test/debug locally without publishing it?.

Thanks in advance

@antfu
Copy link
Member

antfu commented Dec 28, 2020

You can definitely use it without publishing.

Can't find the issue, did you external vue-demi from your bundle?

@alvarosabu
Copy link
Author

Do you mean using vue-demi in the vue-2 app?

I only installed vue-demi on the plugin root, not in the vue-2 or vue-3 demos.

I noticed when building the plugin with a console.log if isVue2 is always false in the result bundle

@alvarosabu
Copy link
Author

alvarosabu commented Dec 30, 2020

Can't find the issue, did you external vue-demi from your bundle?

I finally understood what you mean @antfu, I updated my rollup.config.js to use vue-demi as external (similar to what @posva did in vue-promised here) but same errors popup in console

as-dynamic-forms.esm.js?3936:631 Uncaught TypeError: Object(...) is not a function

Screenshot 2020-12-30 at 17 03 20

The only difference I see now is that I'm using https://github.com/vuejs/rollup-plugin-vue to bundle the vue files, I'm using a symlink to test locally but not sure if it's the best idea, do you have any suggestion on how could I test this?

Thanks in advance.

@alvarosabu
Copy link
Author

alvarosabu commented Jan 4, 2021

Hi, @antfu I will close this issue since I found out that the origin of the problems are not related to your library but related to using rollup-plugin-vue in the build config.

My rough guess is that rollup-plugin-vue uses a specific version of vue because all errors prompt are related to rendering.

I opened a feature request on the rollup-plugin-vue repo for vue-demi to be used along with it. In the meantime, I will try to refactor all my components in my library to use typescript only.

If you want to play around with the reproduction repo, is this one https://github.com/alvarosaburido/vue-demi-universal-lib

Thanks and happy coding.

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

2 participants