fix(shared): drop .js extensions from relative imports for Metro
packages/shared/src/index.ts and all sub-modules used .js extensions on relative imports (e.g. './admin/index.js') pointing at .ts source files. TypeScript with moduleResolution: "Bundler" doesn't need them, and Metro's eager exporter (used for preview / production builds) reads them literally and fails — only the dev-server Metro fell back to .ts. Workspace typecheck remains 8/8 green; Vite and TS Bundler resolution already accept both styles, so desktop is unaffected.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_LOCALE, SUPPORTED_LOCALES, type SupportedLocale } from './types.js';
|
||||
import { DEFAULT_LOCALE, SUPPORTED_LOCALES, type SupportedLocale } from './types';
|
||||
|
||||
export function isSupportedLocale(value: string | null | undefined): value is SupportedLocale {
|
||||
return (
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import i18next, { type i18n as I18nInstance, type Resource } from 'i18next';
|
||||
import i18next, { type i18n as I18nInstance, type Resource } from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
import { resources } from './resources.js';
|
||||
import { DEFAULT_LOCALE, type SupportedLocale } from './types.js';
|
||||
import { resources } from './resources';
|
||||
import { DEFAULT_LOCALE, type SupportedLocale } from './types';
|
||||
|
||||
export * from './detect.js';
|
||||
export * from './error-map.js';
|
||||
export * from './types.js';
|
||||
export * from './detect';
|
||||
export * from './error-map';
|
||||
export * from './types';
|
||||
|
||||
export interface InitI18nOptions {
|
||||
initialLocale: SupportedLocale;
|
||||
@@ -14,7 +14,7 @@ export interface InitI18nOptions {
|
||||
onLanguageChanged?: (locale: SupportedLocale) => void;
|
||||
}
|
||||
|
||||
// Idempotent init — safe to call from multiple entry points.
|
||||
// Idempotent init — safe to call from multiple entry points.
|
||||
// Returns the configured i18next instance.
|
||||
export function initI18n(options: InitI18nOptions): I18nInstance {
|
||||
if (!i18next.isInitialized) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import deApp from './locales/de/app.json';
|
||||
import deApp from './locales/de/app.json';
|
||||
import deAuth from './locales/de/auth.json';
|
||||
import deCommon from './locales/de/common.json';
|
||||
import deErrors from './locales/de/errors.json';
|
||||
@@ -6,7 +6,7 @@ import enApp from './locales/en/app.json';
|
||||
import enAuth from './locales/en/auth.json';
|
||||
import enCommon from './locales/en/common.json';
|
||||
import enErrors from './locales/en/errors.json';
|
||||
import type { Resources, SupportedLocale } from './types.js';
|
||||
import type { Resources, SupportedLocale } from './types';
|
||||
|
||||
export const resources: Record<SupportedLocale, Resources> = {
|
||||
en: { common: enCommon, auth: enAuth, errors: enErrors, app: enApp },
|
||||
|
||||
Reference in New Issue
Block a user