next-translate-plugin 2.4.1 → 2.4.2
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/lib/cjs/index.js +2 -2
- package/lib/cjs/loader.js +2 -3
- package/lib/esm/index.js +2 -2
- package/lib/esm/loader.js +2 -3
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -73,8 +73,8 @@ function nextTranslate(nextConfig) {
|
|
|
73
73
|
loader: 'next-translate-plugin/loader',
|
|
74
74
|
options: {
|
|
75
75
|
basePath: basePath,
|
|
76
|
-
pagesFolder: path_1.default.join(pagesFolder, '/'),
|
|
77
|
-
appFolder: path_1.default.join(appFolder, '/'),
|
|
76
|
+
pagesFolder: path_1.default.join(pagesFolder, '/').replace(/\\/g, '/'),
|
|
77
|
+
appFolder: path_1.default.join(appFolder, '/').replace(/\\/g, '/'),
|
|
78
78
|
hasAppJs: hasAppJs,
|
|
79
79
|
hasGetInitialPropsOnAppJs: hasGetInitialPropsOnAppJs,
|
|
80
80
|
extensionsRgx: extensionsRgx,
|
package/lib/cjs/loader.js
CHANGED
|
@@ -21,7 +21,6 @@ function loader(rawCode) {
|
|
|
21
21
|
var shouldUseTemplateAppDir = isClientComponent ||
|
|
22
22
|
normalizedResourcePath.includes(appFolder.replace(/\\/g, '/'));
|
|
23
23
|
var pagesPath = (shouldUseTemplateAppDir ? appFolder : pagesFolder);
|
|
24
|
-
var normalizedPagesPath = pagesPath.replace(/\\/g, '/');
|
|
25
24
|
if (normalizedResourcePath.includes('node_modules/next/dist/pages/_app') &&
|
|
26
25
|
!hasAppJs) {
|
|
27
26
|
return (0, utils_1.getDefaultAppJs)(existLocalesFolder);
|
|
@@ -29,9 +28,9 @@ function loader(rawCode) {
|
|
|
29
28
|
if (normalizedResourcePath.includes('node_modules/'))
|
|
30
29
|
return rawCode;
|
|
31
30
|
if (!shouldUseTemplateAppDir &&
|
|
32
|
-
!normalizedResourcePath.includes(
|
|
31
|
+
!normalizedResourcePath.includes(pagesPath))
|
|
33
32
|
return rawCode;
|
|
34
|
-
var page = normalizedResourcePath.replace(
|
|
33
|
+
var page = normalizedResourcePath.replace(pagesPath, '/');
|
|
35
34
|
var pageNoExt = page.replace(extensionsRgx, '');
|
|
36
35
|
var pagePkg = (0, utils_1.parseFile)(basePath, normalizedResourcePath);
|
|
37
36
|
if ((0, utils_1.hasExportName)(pagePkg, '__N_SSP') ||
|
package/lib/esm/index.js
CHANGED
|
@@ -68,8 +68,8 @@ function nextTranslate(nextConfig) {
|
|
|
68
68
|
loader: 'next-translate-plugin/loader',
|
|
69
69
|
options: {
|
|
70
70
|
basePath: basePath,
|
|
71
|
-
pagesFolder: path.join(pagesFolder, '/'),
|
|
72
|
-
appFolder: path.join(appFolder, '/'),
|
|
71
|
+
pagesFolder: path.join(pagesFolder, '/').replace(/\\/g, '/'),
|
|
72
|
+
appFolder: path.join(appFolder, '/').replace(/\\/g, '/'),
|
|
73
73
|
hasAppJs: hasAppJs,
|
|
74
74
|
hasGetInitialPropsOnAppJs: hasGetInitialPropsOnAppJs,
|
|
75
75
|
extensionsRgx: extensionsRgx,
|
package/lib/esm/loader.js
CHANGED
|
@@ -16,7 +16,6 @@ export default function loader(rawCode) {
|
|
|
16
16
|
var shouldUseTemplateAppDir = isClientComponent ||
|
|
17
17
|
normalizedResourcePath.includes(appFolder.replace(/\\/g, '/'));
|
|
18
18
|
var pagesPath = (shouldUseTemplateAppDir ? appFolder : pagesFolder);
|
|
19
|
-
var normalizedPagesPath = pagesPath.replace(/\\/g, '/');
|
|
20
19
|
if (normalizedResourcePath.includes('node_modules/next/dist/pages/_app') &&
|
|
21
20
|
!hasAppJs) {
|
|
22
21
|
return getDefaultAppJs(existLocalesFolder);
|
|
@@ -24,9 +23,9 @@ export default function loader(rawCode) {
|
|
|
24
23
|
if (normalizedResourcePath.includes('node_modules/'))
|
|
25
24
|
return rawCode;
|
|
26
25
|
if (!shouldUseTemplateAppDir &&
|
|
27
|
-
!normalizedResourcePath.includes(
|
|
26
|
+
!normalizedResourcePath.includes(pagesPath))
|
|
28
27
|
return rawCode;
|
|
29
|
-
var page = normalizedResourcePath.replace(
|
|
28
|
+
var page = normalizedResourcePath.replace(pagesPath, '/');
|
|
30
29
|
var pageNoExt = page.replace(extensionsRgx, '');
|
|
31
30
|
var pagePkg = parseFile(basePath, normalizedResourcePath);
|
|
32
31
|
if (hasExportName(pagePkg, '__N_SSP') ||
|