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

mobx-react-form "constructor.name" is mangled by uglify. [use --keep-fnames] #31

Closed
richieio opened this issue Nov 8, 2016 · 4 comments
Labels

Comments

@richieio
Copy link

richieio commented Nov 8, 2016

Hi Claudio,

Thank you so much for the great rfx-stack and mobx-react-form. I follow and use it a lot.

I've been struggling with this strange issue though. When I set a value of a form field manually, it works in development but not in production environment.

For instance, in the AuthFormLogin.jsx file if I add a button

<button type="button" className="btn" onClick={() => form.update({ email: 'test' })} >Test button</button>

I should be able to set the form field value.

This works in development web:dev, but not in production web:prod. Same with form.$field.set('value'). Any idea?

Thank you much appreciated.

@foxhound87
Copy link
Owner

Hi @richattack

I made some tests and it is a minification issue.

For now remove -p for the build:client:web script and the UglifyJsPlugin into the webpack/config.client.build.js.

I will find a solution asap.

foxhound87 added a commit that referenced this issue Nov 8, 2016
foxhound87 added a commit that referenced this issue Nov 8, 2016
@foxhound87
Copy link
Owner

Now should work.

I introduced keep_fnames for the uglify mangle.

This because I'm using .constructor.name to check the name of the Field Class into the mobx-react-form package, which is mangled by uglify.

Please let me know if it's all ok now.

@foxhound87 foxhound87 changed the title mobx-react-form set value in production mobx-react-form "constructor.name" is mangled by uglify. [use --keep-fnames] Nov 8, 2016
@foxhound87 foxhound87 added the bug label Nov 8, 2016
@richieio
Copy link
Author

richieio commented Nov 8, 2016

Thanks so much Claudio!!! Everything is OK.

@foxhound87
Copy link
Owner

You are welcome!
Thanks to you for your contribution,
I didn't found this issue before you do.
This fix has fixed the umd build too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants