diff --git a/packages/utils/time.ts b/packages/utils/time.ts index ade8857f9..f8d959837 100644 --- a/packages/utils/time.ts +++ b/packages/utils/time.ts @@ -4,7 +4,12 @@ // ----------------------------------------------------------------------------------------------- import * as dayjs from 'dayjs'; -import * as dayJsRelativeTime from 'dayjs/plugin/relativeTime'; + +// Separating this into a type import and a require seems to be necessary to support mobile: +// - import = require syntax doesn't work when bundling +// - import * as dayJsRelativeTimeType causes a runtime error. +import type * as dayJsRelativeTimeType from 'dayjs/plugin/relativeTime'; +const dayJsRelativeTime: typeof dayJsRelativeTimeType = require('dayjs/plugin/relativeTime'); const supportedLocales: Record = { 'ar': require('dayjs/locale/ar'),