Closed TheMatrixan closed 1 year ago
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch next-translate-plugin@2.0.5 for the project I'm working on.
next-translate-plugin@2.0.5
Here is the diff that solved my problem which was that plugin is not working with Next.js custom page extensions:
diff --git a/node_modules/next-translate-plugin/lib/cjs/loader.js b/node_modules/next-translate-plugin/lib/cjs/loader.js index 686d7b1..f87ebb7 100644 --- a/node_modules/next-translate-plugin/lib/cjs/loader.js +++ b/node_modules/next-translate-plugin/lib/cjs/loader.js @@ -31,11 +31,11 @@ function loader(rawCode) { return rawCode; } if (hasGetInitialPropsOnAppJs) { - return pageNoExt === '/_app' + return pageNoExt.startsWith('/_app') ? (0, templateWithHoc_1.default)(pagePkg, { hasLoadLocaleFrom: hasLoadLocaleFrom }) : rawCode; } - if (pageNoExt === '/_app') { + if (pageNoExt.startsWith('/_app')) { return (0, templateWithHoc_1.default)(pagePkg, { skipInitialProps: true, hasLoadLocaleFrom: hasLoadLocaleFrom, diff --git a/node_modules/next-translate-plugin/lib/esm/loader.js b/node_modules/next-translate-plugin/lib/esm/loader.js index 4950f3a..6137ff7 100644 --- a/node_modules/next-translate-plugin/lib/esm/loader.js +++ b/node_modules/next-translate-plugin/lib/esm/loader.js @@ -26,11 +26,11 @@ export default function loader(rawCode) { return rawCode; } if (hasGetInitialPropsOnAppJs) { - return pageNoExt === '/_app' + return pageNoExt.startsWith('/_app') ? templateWithHoc(pagePkg, { hasLoadLocaleFrom: hasLoadLocaleFrom }) : rawCode; } - if (pageNoExt === '/_app') { + if (pageNoExt.startsWith('/_app')) { return templateWithHoc(pagePkg, { skipInitialProps: true, hasLoadLocaleFrom: hasLoadLocaleFrom,
This issue body was partially generated by patch-package.
Feel free to PR @TheMatrixan π
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
next-translate-plugin@2.0.5
for the project I'm working on.Here is the diff that solved my problem which was that plugin is not working with Next.js custom page extensions:
This issue body was partially generated by patch-package.