Yup: undefined is not an object (evaluating '_yup2.default.object') in v 0.25

Created on 28 May 2018  路  5Comments  路  Source: jquense/yup

Hi guys, when update to v 0.25.0 im getting the following error:

simulator screen shot - iphone x - 2018-05-28 at 17 13 15

Here the code:

import Yup from 'yup';
// ...
validationSchema={Yup.object().shape({
  username: Yup.string().required(I18n.t('user_required')),
  password: Yup.string().required(I18n.t('password_required')),
})} 

What it means? in v 0.24 works as expected, thanks !!!

Most helpful comment

Change the import from import Yup from 'yup'; to import * as Yup from 'yup';

All 5 comments

Running into this issue too with 0.25. Had to roll back to 0.24. My page breaks with the same error above. It seems the Yup object is undefined.

There is no defaul any more in the last version, check the changelog and documentation, and use named imports, thanks

@jquense sorry my fault, here new usage:

https://github.com/jquense/yup#usage

now it works !!! Thanks !!!

Change the import from import Yup from 'yup'; to import * as Yup from 'yup';

thanks @luanws

Was this page helpful?
0 / 5 - 0 ratings