mobxjs / mobxjs/mobx-devtools

conditional import based on NODE_ENV

Open
#50 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
502
Forks
34
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the build configuration and the NODE_ENV conditional import shown in the issue, then check how production bundling treats that branch. Done means documenting the supported behavior and whether callers need the deferred require.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools, tooling
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.