From 9892d57d679e01678b8bc700e12ac9217995765c Mon Sep 17 00:00:00 2001 From: haad Date: Thu, 12 Jan 2023 11:08:50 +0200 Subject: [PATCH] Fix fs-shim --- src/fs-shim.js | 9 +++++++-- src/migrations/0.21-0.22.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/fs-shim.js b/src/fs-shim.js index b41602e..470ae8a 100644 --- a/src/fs-shim.js +++ b/src/fs-shim.js @@ -1,4 +1,9 @@ /* eslint-disable */ -import where from 'wherearewe' +import { isElectronMain } from 'wherearewe' +import * as fs_ from 'fs' -export const fs = (!where.isElectronMain && (typeof window === 'object' || typeof self === 'object')) ? null : eval('import("fs")') +export const fs = (!isElectronMain && (typeof window === 'object' || typeof self === 'object')) + ? null + : fs_ + +export default fs diff --git a/src/migrations/0.21-0.22.js b/src/migrations/0.21-0.22.js index 114a465..5d270a6 100644 --- a/src/migrations/0.21-0.22.js +++ b/src/migrations/0.21-0.22.js @@ -1,5 +1,5 @@ import path from 'path' -import * as fs from '../fs-shim.js' +import fs from '../fs-shim.js' import Cache from 'orbit-db-cache' import Logger from 'logplease' const logger = Logger.create('orbit-db')