Skip to content

Make React run without es5-sham #4189

@dantman

Description

@dantman

I'm ok with React requiring shims. I'd include them whether React needed them or not. However I don't believe React should require es5-sham to work. Because, among other reasons, including shams has the potential to break other libraries on the same page and hence doesn't sound like a good practice for one library to demand.

Of the two shams React says it requires (in the 0.14 code in npm) each one is only used once in the entire codebase.

2 function invocations doesn't sound like a good reason for requiring a 5kb library that has potential side effects.

The best practice for React would probably be to provide its own small module providing either the native function or an internal sham.

This would also be a positive. As these internal shams wouldn't have to waste bytes trying to sham functionality that React doesn't need. And they could emit invariant warnings when misused during development instead of failing (potentially silently) the way they would in es5-sham.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions