mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
top level await in iife build mode is not supported, so let's do import.meta.glob instead (we just need the build step not to see await, the code doesn't actually ever get loaded because it's DEV only)
This commit is contained in:
@@ -15,7 +15,10 @@ let django: Django
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
// TODO this does not actually grab the correct language strings
|
||||
const raw = (await import(`../../../jsi18n/${LANG}/djangojs.js?raw`)).default
|
||||
const modules = import.meta.glob('../../../jsi18n/*/djangojs.js', { eager: true, query: '?raw', import: 'default' }) as Record<string, string>
|
||||
const key = `../../../jsi18n/${LANG}/djangojs.js`
|
||||
const raw = modules[key]
|
||||
if (!raw) throw new Error(`Missing i18n module for lang "${LANG}": ${key}`)
|
||||
const context: { django?: Django } = {}
|
||||
new Function(raw).call(context)
|
||||
django = context.django!
|
||||
|
||||
Reference in New Issue
Block a user