@zachhandley/ez-i18n 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/src/vite-plugin.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -268,7 +268,7 @@ function vitePlugin(config) {
|
|
|
268
268
|
localeBaseDir: localeBaseDirs[locale]
|
|
269
269
|
};
|
|
270
270
|
if (isDev && config.translations) {
|
|
271
|
-
const localeConfig = typeof config.translations === "string" ? path2.join(config.translations, locale) : config.translations[locale];
|
|
271
|
+
const localeConfig = typeof config.translations === "string" ? path2.join(config.translations, locale) + "/" : config.translations[locale];
|
|
272
272
|
if (localeConfig && typeof localeConfig === "string") {
|
|
273
273
|
const pathType = detectPathType(localeConfig);
|
|
274
274
|
if (pathType === "folder" || pathType === "glob") {
|
|
@@ -470,7 +470,7 @@ function generateDevTranslationsModule(translationInfo, projectRoot, pathBasedNa
|
|
|
470
470
|
});
|
|
471
471
|
loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
|
|
472
472
|
const fileInfos = [${fileEntries.join(", ")}];
|
|
473
|
-
const modules = await Promise.all(fileInfos.map(f => import(f.path)));
|
|
473
|
+
const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
|
|
474
474
|
const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
|
|
475
475
|
return __deepMerge({}, ...wrapped);
|
|
476
476
|
}`);
|
|
@@ -543,7 +543,7 @@ function generateBuildTranslationsModule(translationInfo, projectRoot, pathBased
|
|
|
543
543
|
});
|
|
544
544
|
loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
|
|
545
545
|
const fileInfos = [${fileEntries.join(", ")}];
|
|
546
|
-
const modules = await Promise.all(fileInfos.map(f => import(f.path)));
|
|
546
|
+
const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
|
|
547
547
|
const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
|
|
548
548
|
return __deepMerge({}, ...wrapped);
|
|
549
549
|
}`);
|
package/package.json
CHANGED
package/src/vite-plugin.ts
CHANGED
|
@@ -154,7 +154,7 @@ export function vitePlugin(config: EzI18nConfig): Plugin {
|
|
|
154
154
|
// For dev mode, determine if we can use import.meta.glob
|
|
155
155
|
if (isDev && config.translations) {
|
|
156
156
|
const localeConfig = typeof config.translations === 'string'
|
|
157
|
-
? path.join(config.translations, locale)
|
|
157
|
+
? path.join(config.translations, locale) + '/' // Trailing slash ensures detectPathType returns 'folder'
|
|
158
158
|
: config.translations[locale];
|
|
159
159
|
|
|
160
160
|
if (localeConfig && typeof localeConfig === 'string') {
|
|
@@ -415,7 +415,7 @@ function generateDevTranslationsModule(
|
|
|
415
415
|
|
|
416
416
|
loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
|
|
417
417
|
const fileInfos = [${fileEntries.join(', ')}];
|
|
418
|
-
const modules = await Promise.all(fileInfos.map(f => import(f.path)));
|
|
418
|
+
const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
|
|
419
419
|
const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
|
|
420
420
|
return __deepMerge({}, ...wrapped);
|
|
421
421
|
}`);
|
|
@@ -506,7 +506,7 @@ function generateBuildTranslationsModule(
|
|
|
506
506
|
|
|
507
507
|
loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
|
|
508
508
|
const fileInfos = [${fileEntries.join(', ')}];
|
|
509
|
-
const modules = await Promise.all(fileInfos.map(f => import(f.path)));
|
|
509
|
+
const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
|
|
510
510
|
const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
|
|
511
511
|
return __deepMerge({}, ...wrapped);
|
|
512
512
|
}`);
|