commit 4bc6f834534c254daf0a6f12785ea45f3e6c44bb
parent 048a5e910053b1487fe9fa25ed1cde09be99ee20
Author: Pavel Lang <langpavel@phpskelet.org>
Date: Thu, 16 Feb 2017 05:05:15 +0100
Free __DEV__ variable provided by webpack should be used across RSK (#1114)
Free __DEV__ variable provided by webpack should be used across RSK instead of NODE_ENV checks
Thanks @buildbreakdo
Diffstat:
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/client.js b/src/client.js
@@ -127,7 +127,7 @@ async function onLocationChange(location, action) {
);
} catch (error) {
// Display the error in full-screen for development mode
- if (process.env.NODE_ENV !== 'production') {
+ if (__DEV__) {
appInstance = null;
document.title = `Error: ${error.message}`;
ReactDOM.render(<ErrorReporter error={error} />, container);
@@ -150,7 +150,7 @@ onLocationChange(currentLocation);
// Handle errors that might happen after rendering
// Display the error in full-screen for development mode
-if (process.env.NODE_ENV !== 'production') {
+if (__DEV__) {
window.addEventListener('error', (event) => {
appInstance = null;
document.title = `Runtime Error: ${event.error.message}`;
diff --git a/src/core/devUtils.js b/src/core/devUtils.js
@@ -9,7 +9,7 @@
/* eslint-disable global-require */
-if (module.hot || process.env.NODE_ENV !== 'production') {
+if (module.hot || __DEV__) {
module.exports = {
// The red box (aka red screen of death) component to display your errors
// https://github.com/commissure/redbox-react
diff --git a/src/routes/error/ErrorPage.js b/src/routes/error/ErrorPage.js
@@ -21,7 +21,7 @@ class ErrorPage extends React.Component {
};
render() {
- if (process.env.NODE_ENV !== 'production') {
+ if (__DEV__) {
const { error } = this.props;
return (
<div>
diff --git a/src/server.js b/src/server.js
@@ -56,7 +56,7 @@ app.use(expressJwt({
}));
app.use(passport.initialize());
-if (process.env.NODE_ENV !== 'production') {
+if (__DEV__) {
app.enable('trust proxy');
}
app.get('/login/facebook',
@@ -77,9 +77,9 @@ app.get('/login/facebook/return',
// -----------------------------------------------------------------------------
app.use('/graphql', expressGraphQL(req => ({
schema,
- graphiql: process.env.NODE_ENV !== 'production',
+ graphiql: __DEV__,
rootValue: { request: req },
- pretty: process.env.NODE_ENV !== 'production',
+ pretty: __DEV__,
})));
//