-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Move miniKindOf out of if scope to fix ES5 compatibility issue #4090
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 89a516c:
|
Deploy Preview for redux-docs ready! Built with commit 89a516c |
FYI, this really needs to be based against the Also, I'd like to make sure that the function only actually exists in dev mode to save on byte size, but that itself requires an |
Thanks; I've force pushed a version based off 4.x.
Assuming that production environments are using something like terser, wouldn't it automatically see the function as dead code and remove it, since the I've tested it locally by replacing the check with |
Okay, sounds good. There's a couple other little bits that probably need to go into a 4.1.1, so I'll see if I can get this out in the next couple days. |
Move miniKindOf out of if scope to fix ES5 compatibility issue
Move miniKindOf out of if scope to fix ES5 compatibility issue Former-commit-id: cecf124
Former-commit-id: 4627a1a
name: 🐛 Bug fix or new feature
about: Fixing a problem with Redux
PR Type
Does this PR add a new feature, or fix a bug?
It fixes a bug.
Why should this PR be included?
Currently redux cannot be run in ES5 environments even if Babel is used.
Checklist
Bug Fixes
What is the current behavior, and the steps to reproduce the issue?
Please refer to #4089.
TL;DR There are functions declared inside an
if
statement, which ES5 forbids and Babel does not fix.What is the expected behavior?
Redux should run without any syntax errors, if it's being bundled and transpiled in the standard manner for ES5.
How does this PR fix the problem?
It moves the aforementioned functions out of the if statement and into the file's scope.
The diff looks huge but it's mostly due to the indentation changing.