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

Cannot read property 'alpha2' of undefined #74

Open
Vadorequest opened this issue Sep 5, 2019 · 1 comment
Open

Cannot read property 'alpha2' of undefined #74

Vadorequest opened this issue Sep 5, 2019 · 1 comment

Comments

@Vadorequest
Copy link

Vadorequest commented Sep 5, 2019

Trying the basic example in my app, it works fine with to3() but fails with to2().

Cannot read property 'alpha2' of undefined

TypeError: Cannot read property 'alpha2' of undefined
    at Object.b [as to2] (/Users/vadorequest/dev/loan-advisor/node_modules/iso3166-1/dist/iso3166-1.js:3:11181)
    at Object../hoc/withData.js (/Users/vadorequest/dev/loan-advisor/hoc/withData.js:16:5)
    at __webpack_require__ (/Users/vadorequest/dev/loan-advisor/.next/dist/bundles/pages/webpack/bootstrap b368674930c3372dd65a:21:1)
    at Object../pages/school/index.js (/Users/vadorequest/dev/loan-advisor/pages/school/index.js:18:1)
    at __webpack_require__ (/Users/vadorequest/dev/loan-advisor/.next/dist/bundles/pages/webpack/bootstrap b368674930c3372dd65a:21:1)
    at Object.2 (/Users/vadorequest/dev/loan-advisor/.next/dist/bundles/pages/school.js:3556:18)
    at __webpack_require__ (/Users/vadorequest/dev/loan-advisor/.next/dist/bundles/pages/webpack/bootstrap b368674930c3372dd65a:21:1)
    at module.exports../components/Bloc.js.Object.defineProperty.value (/Users/vadorequest/dev/loan-advisor/.next/dist/bundles/pages/webpack/bootstrap b368674930c3372dd65a:68:1)
    at Object.<anonymous> (/Users/vadorequest/dev/loan-advisor/.next/dist/bundles/pages/school.js:73:10)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)

With the following source code:

import locale2 from 'locale2';
import iso3166 from 'iso3166-1';

console.log(locale2)
console.log(iso3166.fromLocale(locale2))
console.log(iso3166.fromLocale(locale2).to2())

Here is what I get with to3()
image

Tested on both Chrome latest and Firefox, same result

@Vadorequest
Copy link
Author

I opened a PR. The reason why it failed is still unknown to me, the tests are passing properly on my machine with the same example (en-US), I really don't get it. Maybe some race condition related to the bundle, compilation, minification, etc.

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

1 participant