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

Detect when a polyfill is missing #690

Closed
kassens opened this issue Dec 17, 2015 · 4 comments
Closed

Detect when a polyfill is missing #690

kassens opened this issue Dec 17, 2015 · 4 comments

Comments

@kassens
Copy link
Member

kassens commented Dec 17, 2015

Should we add some simple basic detection for missing polyfills so we can provide a helpful error message instead of some "method x is undefined" errors deep in the stack? (Example: #681)

Not full feature detection, but maybe something basic as:

warning(
  Promise && Array.prototype.find,
  'Relay relies on polyfills for older browsers. Babel '
  'provides a good one: https://babeljs.io/docs/usage/polyfill/'
)
@josephsavona
Copy link
Contributor

This is a great idea. Ship it! ;-)

@KyleAMathews
Copy link
Contributor

👍 this would of saved me some debugging time this morning :)

@edvinerikson
Copy link
Contributor

If this is something that we still want to do I'll be happy to hack on it.

if (process.env.NODE_ENV === 'development') {
  warning(
    -es6-features-here,
    'message here'
  );
}

Would something like that work and where should the check live? RelayPublic?

@josephsavona
Copy link
Contributor

@edvinerikson the best place is Relay.js. The check should likely use if (__DEV__) { ... }, which i think we transform appropriately (probably easiest to just try that and see what it builds to).

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

No branches or pull requests

4 participants