catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.79k stars 216 forks source link

"export 'getCountryCallingCode' (reexported as 'default') was not found in './metadata #289

Closed Nuruddinjr closed 5 years ago

Nuruddinjr commented 5 years ago
Failed to compile
./node_modules/libphonenumber-js/es6/getCountryCallingCode.js
"export 'getCountryCallingCode' (reexported as 'default') was not found in './metadata'

I was using 1.6.9 version of library, when I upgraded to 1.7.5 this error comes up.

catamphetamine commented 5 years ago

post your ./node_modules/libphonenumber-js/es6/metadata.js

catamphetamine commented 5 years ago

As you can see, getCountryCallingCode is exported from ./metadata. https://unpkg.com/libphonenumber-js@1.7.5/es6/metadata.js

export function getCountryCallingCode(country, metadata) {
    metadata = new Metadata(metadata);
    if (!metadata.hasCountry(country)) {
        throw new Error('Unknown country: ' + country);
    }
    return metadata.country(country).countryCallingCode();
}

My tests also work. It could be a bug in a bundler you're using. Or maybe something's messed up in the node_modules fodler.