-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
fix(index.js): Add check for process object which might not be defined #1741
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
Conversation
The CommonJS build is not intended to be used in browsers. (In fact, there is no way you could run it in a browser because it uses The compiled UMD build does not contain Thanks for the effort though! |
|
I'm using browserify to bundle the redux code along with some other modules. There is a browserify option that lets you omit builtins like process which trims down the bundle to only module loading support. My thinking was that by checking for the existence of process the code would be less dependent on the type of module bundler used. |
|
@natewallace I believe browserify should be checking |
|
I'm not creating the redux bundle independently but rather I'm pulling redux into a bundle that includes several other modules so I'm not using the browserify configuration found in this project. I already have a workaround for my scenario but thought my pull request would make the code less dependent on a particular module bundler or its setup. Just my 2 cents. |
|
The problem with this is it’s a pain to remember and test all possible different configurations. Our advice is simple: if you use CommonJS build, it is up to you to envify it. If you’d rather not, you can use the UMD build as it is. |
|
For the record, this is exactly what React does as well. |
|
@natewallace when you use redux as a dependency in your project and bundle your project with browserify, it executes the @gaearon please correct me if I'm wrong. |
|
@simplesmiler The exception is when you manually tell Browserify not to read local transforms. I think it had some flag for that. |
If the redux module has been bundled outside of webpack and is running on a client browser the process object may not be defined. This pull request adds a check to make sure the process object is ok to use.