1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Mobile: Fix dayjs-related startup error (#10652)

This commit is contained in:
Henry Heino 2024-06-24 08:15:57 -07:00 committed by GitHub
parent 94edaea210
commit 1d46adf801
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,12 @@
// ----------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------
import * as dayjs from 'dayjs'; 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<string, unknown> = { const supportedLocales: Record<string, unknown> = {
'ar': require('dayjs/locale/ar'), 'ar': require('dayjs/locale/ar'),