-
|
I'm running a project based on the documentation on the vue-adapter. /src/i18n/nl/index.ts and /src/i18n/en/index.ts The plugin is initialised in main.ts My watcher keeps telling me: Any idea if I'm missing anything? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
You must import the types |
Beta Was this translation helpful? Give feedback.
-
|
This is a little bit late. but I made a patch which let you configure paths in your You can use it with patch-package File name: diff --git a/node_modules/typesafe-i18n/cli/typesafe-i18n.mjs b/node_modules/typesafe-i18n/cli/typesafe-i18n.mjs
index cbf5271..0dfc4fa 100644
--- a/node_modules/typesafe-i18n/cli/typesafe-i18n.mjs
+++ b/node_modules/typesafe-i18n/cli/typesafe-i18n.mjs
@@ -22855,14 +22855,31 @@ See the example in the official docs: https://github.com/ivanhofer/typesafe-i18n
}
return "";
};
+var readPathsFromTsConfig = async (path) => {
+ const tsConfig = await read(path, "utf-8").then((res) => {
+ return JSON.parse(res);
+ });
+ const paths = {};
+ if (tsConfig.compilerOptions && tsConfig.compilerOptions.paths) {
+ Object.assign(paths, tsConfig.compilerOptions.paths);
+ }
+ if (tsConfig.references) {
+ for (const reference of tsConfig.references) {
+ Object.assign(paths, (await readPathsFromTsConfig(reference.path)));
+ }
+ }
+ return paths;
+};
var transpileTypescriptFiles = async (outputPath, outputFormat2, languageFilePath, locale, tempPath, typesFileName) => {
+ const paths = await readPathsFromTsConfig("./tsconfig.json");
const program3 = ts.createProgram([languageFilePath], {
outDir: tempPath,
allowJs: true,
resolveJsonModule: true,
skipLibCheck: true,
sourceMap: false,
- noLib: true
+ noLib: true,
+ paths: paths
});
program3.emit();
const baseTranslationPath = await detectLocationOfCompiledBaseTranslation(Note: You can't have comments in the tsconfig file, it has to be a valid JSON |
Beta Was this translation helpful? Give feedback.
You must import the types
BaseTranslationandTranslationvia a relative path. This is a limitation due toTypeScriptneeding to resolve all imports in a locale folder.