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

Object.assign polyfill is not being transformed correctly #317

Closed
1 task done
gabarmas-ibm opened this issue Sep 8, 2016 · 9 comments
Closed
1 task done

Object.assign polyfill is not being transformed correctly #317

gabarmas-ibm opened this issue Sep 8, 2016 · 9 comments

Comments

@gabarmas-ibm
Copy link

Prerequisites

Description

When loading the form in an ES5 browser, I get the standard "Undefined is not a function" due to the Object.assign in https://github.com/mozilla-services/react-jsonschema-form/blob/3f36b18cb3a5c233def17747bc4145142ec3d955/src/components/Form.js#L125

In issue #206 it sounds like there is a consensus that babel should be transforming those polyfills, but I .babelrc doesn't seem to have any plugin that tackle Object.assign.
Prob this is the reason you had to load a polyfill specifically.

I wonder if that's intentional. I could use a polyfill library, but I'd prefer if your official npm build transforms that polyfill as well.

I'm using babel with babel transform-runtime on my side, but not recompiling any of the nodes_modules.

Steps to Reproduce

  1. Create a simple react component that uses Form
  2. Run it without any polyfill libraries in an ES5 browser (I'm using an old chromium version)

Expected behavior

The form actually loading

Actual behavior

"Undefined is not a function" due to the Object.assign (and no polyfill being loaded)

Version

0.40 (latest)

@makosblade
Copy link

Any workaround for this?

@lekansogunle
Copy link

@makosblade Maybe you can try the babel-plugin-transform-object-assign work around here react-toolbox/react-toolbox#45 .

@graingert
Copy link
Contributor

Mozilla should enable transform-runtime and avoid using ES2015+ methods.

@dalgard
Copy link

dalgard commented Aug 7, 2018

Considering that most users of react-jsonschema-form will have to support IE11 for still some time, doing a transform of Object.assign is simply a no-brainer. It will save everyone a good deal of frustration and unnecessary complexity with no appreciable downsides.

It seems to only be a matter of prepending this to the list of plugins in .babelrc:

    "transform-object-assign",

I encourage you to just get it over with, so you can close this issue 🙏

@graingert
Copy link
Contributor

We've fixed it already @dalgard

@dalgard
Copy link

dalgard commented Aug 7, 2018

That's great news – thanks a lot 👍👍

I was just about to make the concession that IE11 appears to need several other things besides Object.assign to run react-jsonschema-form.

I'll look for the latest version, then. How did you fix it?

@dalgard
Copy link

dalgard commented Aug 7, 2018

You should probably bump the minor version number, since supporting IE11 is a new feature.

@graingert
Copy link
Contributor

#982

@glasserc
Copy link
Contributor

I guess we can close this.

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

6 participants