Skip to content

Commit

Permalink
fix: access process from globalThis (#348)
Browse files Browse the repository at this point in the history
Fixes webpack error:

```
Module not found: Error: Can't resolve 'process/browser' in /path/...
```

Falls back to `setImmediate`, then `setTimeout`.
  • Loading branch information
achingbrain authored Sep 29, 2021
1 parent fedbac1 commit ec96623
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ipfs-repo/src/idstore.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function createIdStore (store) {

// process.nextTick runs on the microtask queue, setImmediate runs on the next
// event loop iteration so is slower. Use process.nextTick if it is available.
const runner = process && process.nextTick ? process.nextTick : setImmediate
const runner = globalThis.process && globalThis.process.nextTick ? globalThis.process.nextTick : (globalThis.setImmediate || globalThis.setTimeout)

runner(async () => {
try {
Expand Down

0 comments on commit ec96623

Please sign in to comment.