iamstevendao / vue-tel-input

International Telephone Input with Vue
https://iamstevendao.com/vue-tel-input/
MIT License
818 stars 342 forks source link

In monorepos the Vue instance is not correctly resolved #459

Open stefusilviu opened 6 months ago

stefusilviu commented 6 months ago

We're trying to use the component in another package as part of a monorepo. When we import the new (wrapper) component, we get this error:TypeError: Cannot read properties of null (reading 'isCE').

version: 9.1.0 Vue: 3.3.4

Vadizar commented 6 months ago

Add in your webpack.config.js:

resolve: {
        alias: {
            vue: path.resolve(dirname, 'node_modules/vue'),
        }
}
stefusilviu commented 6 months ago

Add in your webpack.config.js:

resolve: {
        alias: {
            vue: path.resolve(dirname, 'node_modules/vue'),
        }
}

We're using Vite. I discovered that the problem was the different Vue versions used by our packages so the solutions was to use the resolutions field in our package.json file and set the Vue version accordingly.

But I'm thinking... Why isn't Vue set as peer dependency on this module? This should solve the issue.