Fix vite from complaining about import analysis.

This commit is contained in:
Kavin 2022-10-19 23:16:22 +01:00
parent b5b238656b
commit ce48bd55f1
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
2 changed files with 4 additions and 4 deletions

View file

@ -63,9 +63,9 @@ export default {
const defaultLang = await App.defaultLangage; const defaultLang = await App.defaultLangage;
const locale = App.getPreferenceString("hl", defaultLang); const locale = App.getPreferenceString("hl", defaultLang);
if (locale !== App.TimeAgoConfig.locale) { if (locale !== App.TimeAgoConfig.locale) {
const localeTime = await import( const localeTime = await import(`../node_modules/javascript-time-ago/locale/${locale}.json`).then(
"./../node_modules/javascript-time-ago/locale/" + locale + ".json" module => module.default,
).then(module => module.default); );
App.TimeAgo.addLocale(localeTime); App.TimeAgo.addLocale(localeTime);
App.TimeAgoConfig.locale = locale; App.TimeAgoConfig.locale = locale;
} }

View file

@ -253,7 +253,7 @@ const mixin = {
const languages = window.navigator.languages; const languages = window.navigator.languages;
for (let i = 0; i < languages.length; i++) { for (let i = 0; i < languages.length; i++) {
try { try {
await import("./locales/" + languages[i] + ".json"); await import(`./locales/${languages[i]}.json`);
return languages[i]; return languages[i];
} catch { } catch {
continue; continue;