mobx-devtools icon indicating copy to clipboard operation
mobx-devtools copied to clipboard

conditional import based on NODE_ENV

Open dfee opened this issue 6 years ago • 1 comments

I am creating my store this way:

export const createStore = (initial: StoreSnapshotIn = {}) => {
  const store = Store.create(initial);
  if (process.env.NODE_ENV === "development") {
    const makeInspectable = require("mobx-devtools-mst").default;
    makeInspectable(store);
  }

  return store;
};

Note that i'm doing a deferred import for makeInspectable. I can't really tell if the build would ignore this anyway if NODE_ENV !== 'development, so my question is: is this necessary?

dfee avatar Mar 07 '19 06:03 dfee

This is not really necessary becasue mobx-devtools-mst module is just few lines of code, so it won't hurt https://github.com/mobxjs/mobx-devtools/blob/master/packages/mobx-devtools-mst/src/index.js

andykog avatar Mar 10 '19 17:03 andykog