svelte-intl-precompile icon indicating copy to clipboard operation
svelte-intl-precompile copied to clipboard

Cannot find module '$locales' or its corresponding type declarations

Open RickMeijer opened this issue 3 years ago • 0 comments

When implementing svelte-intl-precompile with the latest sveltekit, I get the following error:

Cannot find module '$locales' or its corresponding type declarations.ts(2307).

Doesn't matter if I use registerAll or individual register. I must be missing something obvious. I found this PR, but it's not in 0.12 AFAIK.

vite.config.ts:

plugins: [sveltekit(), precompileIntl('locales')]

+layout.ts

import { init, waitLocale, getLocaleFromNavigator } from 'svelte-intl-precompile';
import { registerAll, availableLocales } from '$locales'; // <-- red squiggly here

registerAll();
export async function load() {
	init({
		initialLocale: getLocaleFromNavigator() || undefined,
		fallbackLocale: availableLocales[0]
	});
	await waitLocale();
}

Example repo here: https://github.com/RickMeijer/svelte-intl-precompile--locales-error

RickMeijer avatar Nov 25 '22 10:11 RickMeijer