LouisMazel / maz-ui

Vue & Nuxt library of standalone components & tools to build interfaces

Home Page:https://maz-ui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using MazPhoneNumberInput (libphonenumber-js can not be found)

bsiegrist opened this issue · comments

I have a VueJS 3.3.4 App with Vite/Pinia/Vuetify/Axios/Router and I followed your Get-Startet Guide.
Global component installation got me following Error:

Uncaught Error: Could not resolve "libphonenumber-js" imported by "maz-ui". Is it installed?
at optional-peer-dep:__vite-optional-peer-dep:libphonenumber-js:maz-ui:1:7
(anonymous) @ optional-peer-dep:__vite-optional-peer-dep:libphonenumber-js:maz-ui:1

– tried importing in Component instead of globally (same error)
– libponenumber-js is included in Packages, but I also tryed to install separately (same error)
– tried to comment out all other import, so they don't affect mazPhoneNumberInput (same error)
– tried to import all components of maz-ui (same error)

Any Ideas what else could be done?

Hi @bsiegrist,

Did you install libphonenumber-js?

As you can see in the documentation of this component, you just have to install the dependency libphonenumber-js@2. It's required dependency for this specific component.

This dependency is not installed by default by "maz-ui", to avoid installing a dependency on users who do not use this component.

Check out this simple setup, it's working good: https://stackblitz.com/edit/vue3-vite-typescript-starter-1w2hyd

I installed libphonenumber-js but it didn't work unfortunately.

Did you check the codesandbox link I shared?

Can a part of your code where you use the component?
The best way it's a reproduction link with codesandbox