Skip to content

Commit

Permalink
chore: remove process.browser dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jayree committed Jun 26, 2023
1 parent ac8574f commit ce1fda3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/models/FileSystem.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import fs from 'fs'

import pify from 'pify'

import { compareStrings } from '../utils/compareStrings.js'
Expand Down Expand Up @@ -223,11 +225,9 @@ export class FileSystem {
try {
const stats = await this._lstat(filename)
// For non-browser (local) scenarios regular git 'add' command might be used to write the index. Therefore we need to have the exact nanoseconds (see. normalizeStats.js SecondsNanoseconds ).
if (!process.browser) {
const statsNs = await this._lstat(filename, { bigint: true })
stats.mtimeNs = statsNs.mtimeNs
stats.ctimeNs = statsNs.ctimeNs
}
const statsNs = await fs.promises.lstat(filename, { bigint: true })
stats.mtimeNs = statsNs.mtimeNs
stats.ctimeNs = statsNs.ctimeNs
return stats
} catch (err) {
if (err.code === 'ENOENT') {
Expand Down
3 changes: 3 additions & 0 deletions webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
module.exports = [
{
target: 'webworker',
node: {
fs: 'empty',
},
entry: {
index: './src/index.js',
'internal-apis': './src/internal-apis.js',
Expand Down

0 comments on commit ce1fda3

Please sign in to comment.