Skip to content

Is Vite able to import some component library like PrimeVue? #933

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

Closed
Zony-Zhao opened this issue Oct 20, 2020 · 3 comments
Closed

Is Vite able to import some component library like PrimeVue? #933

Zony-Zhao opened this issue Oct 20, 2020 · 3 comments

Comments

@Zony-Zhao
Copy link

I tried to use PrimeVue with vite. The module just cannot resolve correctly.

I imported a .vue file of this lib(sidebar.vue) like so:

image

get error like

image

because Ripple is imported this way,in the source file of the lib(SideBar.vue)

image

and feel really hard to integrate.

my package.json

image

  1. Is there any workaround or any component lib to choose from at this time?
  2. Is this intended to be hard to work with component libs that use webpack?
@underfin
Copy link
Member

See #178 (comment)

@Zony-Zhao
Copy link
Author

@underfin I know I need to import .vue.
image
But 'Ripple' is just a js file. And trigger error as the Image above. Please look into it carefully.

@underfin
Copy link
Member

Oh. Sorry, it caused by Ripple is a common js module. It is not supported by default with vite.
You can add below code into vite.config.js as a workaround, but It's better if you ask the maintainer of primevue export es module.

optimizeDeps: {
    include: ['primevue/components/utils/DomHandler', 'primevue/components/ripple/Ripple'],
  },

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants