Skip to content
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

conditional import based on NODE_ENV #50

Open
dfee opened this issue Mar 7, 2019 · 1 comment
Open

conditional import based on NODE_ENV #50

dfee opened this issue Mar 7, 2019 · 1 comment
Labels

Comments

@dfee
Copy link

dfee commented Mar 7, 2019

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?

@andykog
Copy link
Member

andykog commented Mar 10, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants