Skip to content

Commit ec96623

Browse files
authored
fix: access process from globalThis (#348)
Fixes webpack error: ``` Module not found: Error: Can't resolve 'process/browser' in /path/... ``` Falls back to `setImmediate`, then `setTimeout`.
1 parent fedbac1 commit ec96623

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ipfs-repo/src/idstore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function createIdStore (store) {
6767

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

7272
runner(async () => {
7373
try {

0 commit comments

Comments
 (0)