Skip to content

Commit 7874fd7

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class BlockstoreDatastoreAdapter extends BaseBlockstore {
244244

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

249249
runner(async () => {
250250
try {

0 commit comments

Comments
 (0)