Skip to content

Commit

Permalink
fix: remove global access in decrypt and config in vite
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin9foong committed Dec 23, 2024
1 parent 66b411c commit 2b8d32d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ import {
} from '../types'
import { CsvRecord } from '../utils/CsvRecord.class'

// Fixes issue raised at https://stackoverflow.com/questions/66472945/referenceerror-refreshreg-is-not-defined
// Something to do with babel-loader.
if (import.meta.env.NODE_ENV !== 'production') {
// eslint-disable-next-line
;(global as any).$RefreshReg$ = () => {}
// eslint-disable-next-line
;(global as any).$RefreshSig$ = () => () => {}
}

const queue = new PQueue({ concurrency: 1 })

/**
Expand Down Expand Up @@ -212,7 +203,7 @@ async function decryptIntoCsv(
} catch (error) {
csvRecord.setStatus(CsvRecordStatus.Error, 'Decryption Error')
}
} catch (err) {
} catch (error) {
csvRecord = new CsvRecord(
CsvRecordStatus.Error,
formatInTimeZone(new Date(), 'Asia/Singapore', 'dd MMM yyyy hh:mm:ss z'),
Expand Down
5 changes: 0 additions & 5 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,5 @@ export default defineConfig(() => {
plugins: () => [tsconfigPaths()],
format: 'es' as const,
},
define: {
// On local dev, global is undefined, causing decryption workers to fail.
// This is a workaround based on https://github.com/vitejs/vite/discussions/5912.
global: 'globalThis',
},
}
})

0 comments on commit 2b8d32d

Please sign in to comment.