react-dnd v9 uses spread operator, breaks older browsers
See original GitHub issueDescribe the bug
Typically, consumers of libraries like react-dnd don’t run their node_modules through Babel to transform newer syntax. There’s a bit of a debate over when and how we should all start doing that, but it’s not a great option right now. In v9, the es-modules exported version of react-dnd also started using some newer browser features (specifically, the spread operator) which if not transpiled out will fail to parse in browsers like MS Edge 17 which still don’t support that syntax.
Reproduction
Steps to reproduce the behavior:
- Bundle an app with v9 of react-dnd
- Open in Edge 17.
SCRIPT1028: Expected identifier, string or number
Expected behavior
It’s expected that libraries (even if they are vended as ES modules) do not use newer syntax, or that they include specific instructions in the README that they must be run through babel in order to work.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:9 (5 by maintainers)
Top GitHub Comments
Actually, using babel directly for all transpilation is pretty great. And this wouldn’t necessitate a major version cut
I’ll look into chaining babel after the tsc compilation. I think some light processing to hit a fixed browsers target “>.25%, not dead”, makes sense