conditional import based on NODE_ENV
Open
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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