Exclude Redux DevTools in production
Opened this issue · 0 comments
Need to not render the DevTools control and also not ship the redux-devtools npm modules to the client. The second part of that is trickier. We need to change the modules to devDependencies in package.json (which is fine, just npm remove and then install again with npm save-dev) but then we want conditionally import those modules in the code.
The original imports look like this:
import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor';
import { createDevTools } from 'redux-devtools';
I tried this:
if (debugOnly) {
require('redux-devtools').default
require('redux-devtools-log-monitor').default
require('redux-devtools-dock-monitor').default
}
And that compiles, but the code doesn't run as we still need the named createDevTools constant. Can't work out how to get that with a conditional require.
The Guide doesn't help here: http://guide.meteor.com/v1.3/structure.html
Node Env is now available, so that may be an option: https://forums.meteor.com/t/meteor-1-3-early-beta-now-available/14723/312?u=tomredox.
ffxSams boilerplate has a good example of using NODE_ENV in meteor here: https://github.com/ffxsam/ffx-meteor-react-boilerplate/blob/master/client/store.js