-
-
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
Remove usage of process.env.NODE_ENV
in ES module build
#2907
Comments
Note that React does this too. This is important to prevent against the common mistake of including the development checks in a production build, as they significantly impact the speed of Redux. A workable solution would be to check for |
I see that the corresponding PR has been closed for not being the appropriate solution, but this issue remains. Couls you reopen so we can discuss alternative solutions to resolve this? |
Agreed @TimvdLippe. That Redux modules don't work in the browser without intervention is frustrating. This disrupts otherwise very nice flows like using unpkg.com to serve modules to jsbin and friends. |
Looking at #2910 , it seems that the proposed PR didn't correctly result in the blocks being removed from prod builds. I don't have time to pursue this myself, but if someone can contribute a working solution, we can consider getting it in. |
(Note that the issue being "closed" certainly didn't stop people from being able to discuss this, but I'll re-open it as an indication that it's still a valid topic.) |
EDIT: As the corresponding PR has been merged, please do not use the below method. Use the officially published Redux package instead For anyone looking at a browser-compatible ES-module version, I have a PR open in #3143. However, until the Redux maintainers have decided whether or not to merge the PR, you can depend on https://github.com/TimvdLippe/redux/tree/es-browser-build to use the package. Add the following line to your "dependencies": {
"redux": "timvdlippe/redux.git#es-browser-build"
} |
@TimvdLippe Do you have any examples you can point to where this is used? I'm still getting |
@rjsteinert You have to point to the |
So, I'm a new user to redux and trying to get it to work with rollup (also karma+jasmine) and I'm running into this multiple times. Is there a clean solution to this, or do we still need to do the replace-hack? |
Hi! Is using something like |
Having to import a separate module is not a great solution. Some libraries will do |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
The ES module build of Redux references
process.env.NODE_ENV
which doesn't exist on browsers. With unpkg.com's?module
query param that converts package names to paths, this is the only issue blocking users from loading Redux as a module from the browser.See references to
process.env.NODE_ENV
in:What is the expected behavior?
No references to
process.env.NODE_ENV
in the ES module build.Demo: http://jsbin.com/tazoliy/edit?html,output
The text was updated successfully, but these errors were encountered: